Mutations
A GraphQL mutation is used for modifying data. Separate mutations are available for create
, update
, and delete
and these can be individually enabled per object class. In addition, the mutation persist
is enabled (allowing batch create) whenever the object class has create
enabled for GraphQL. Read more about enabling GraphQL settings here. Mutations can return the modified object(s), so you can immediately access the updated object without having to make a separate request.
Create
Create a single object in the database. The built-in Created Date property (and Created By, if enabled) is automatically set server-side.
Persist (create many / batch create)
For GraphQL enabled Object Classes with Enable Create
, you may create multiple objects at once though the persist
endpoint.
For example, an Object Class Car
with GraphQL Endpoint Name car
will have the mutation persistCar available. See example usage below.
Note that you may also override the default _id in the above persistCar
mutation, simply by adding a valid (and unique) objectid to each record:
Update
Update one or more objects in the database. The built-in Updated Date property (and Updated By, if enabled) is automatically set server-side.
The first parameter is a filter object used to determine which object to update. Find more about filters under Queries.
The second parameter is an input object containing the properties you wish to update.
A count of the number of updated objects is returned.
Delete
Permanently delete one or more objects. A count of the number of updated objects is returned.
Generate Random Identifiers
Generate random identifiers for objects created prior to enabling Random identifier on an Object Class in the Global data model. This operation is performed in batches.
For this mutation to work, GraphQL needs to be enabled, and the Update operation selected. In addition, the Enable GraphQL Auxiliary Endpoints setting you find under Environment needs to be switched on.
The first parameter references the node name of the built-in property random identifier.
The second parameter determines how large the batches will be. The maximum number is 1000.
Both parameters are required.
Last updated