CRUD

CRUD functions can be implemented to create, read, update, and delete models. When these standard functions are insufficient, custom business logic can be added to meet specific requirements.

For each model, multiple READ, UPDATE, and DELETE functions can be created, but only one CREATE function.

Function
HTTP-Method
Description

CREATE

POST

Creates a new database entry of the model and returns it to the client.

READ

GET

Finds a single database entry of the model by a path and/or query parameters and returns it to the client.

READ_ALL

GET

Finds multiple database entries of the model and returns it to the client. Can be specified by query parameters.

UPDATE

PUT

Updates an existing database entry and returns it to the client. Can be specified by path and query parameters.

DELETE

DELETE

Deletes an existing database entry and returns it to the client. Can be specified by path and query parameters.

Path Parameter

Path parameters can be used to adapt and specify single operations. When creating a CRUD function, the path parameter "_id" is used by default. This parameter can be replaced with another property of a model. A path parameter corresponds to an equals query.The following property types are currently supported:

Type
Example
Description

Boolean

/persons/hasJob

Return all peoplewith a job. The Model Personcontains a boolean property called hasJob.

Text

/persons/name

Return all people with the same name. The Model Person contains a text property called name.

Enumeration

/persons/gender

Return all people with the same gender. The Model Person contains a reference to an Enum called gender.

Integer

/persons/age

Return all people within the same age. The Model Person contains an int property called age.

Float

/persons/money

Return all people within the same bank balance. The Model Person contains a float property called money.

Date

/persons/birthdate

Return all people within the same birthdate. The Model Person contains a date property called birthdate.

File

/person/profil_picture

Return a person with a certain profile picture. The Model Person contains a file property called profil_picture. The file _id needs to be used as the value here.

During the execution of the REST call, a value must be provided instead of the property:

Example:

# Give me all the people who are 24 years old.
/persons/24

Location is currently not supported.

At the current time, only one path parameter is allowed

Query Parameter

Query parameters are used as search criteria or filtering options. They allow users to dynamically modify the content they receive by including key-value pairs, like ?name="Stephen"&age=24, in the URL. At the moment, VisualBoost provides the nine different query operations, that can be specified in the Path input field of your CRUD function.

Operators:

Query
Operator
Example
Description

EQUAL

=

/persons?name=

NOT_EQUAL

!=

/persons?name!=

LOWER

<

/persons?age<

LOWER_THAN

<=

/persons?age<=

GREATER

>

/persons?name>

GREATER_THAN

>=

/persons?age>=

IN

.in()

/persons?age.in()

REGEX

.regex()

/persons?name.regex()

Only for text properties

NEAR

.near()

/persons?location.near()

Only for location properties

Static Values

Still in progress....

Last updated