Make changes to the schema using GraphQL mutations
You can use GraphQL to create new objects in your Skedulo application using mutations. GraphQL mutations are used to modify data and can be thought of as a write operation.
A mutation can contain multiple fields that are run in series, with the first field always finishing before the second begins. This is to prevent race conditions.
Note
Values in the provided examples are for demonstration purposes only. Replace these with values that are relevant to your own Skedulo account before sending the query.Mutations with aliases
Skedulo GraphQL supports mutations that include aliases for performing multiple actions. All mutations in a schema
block are performed in a transaction, which reduces the number of mutations required to create, allocate, schedule, update, and dispatch a job. See Perform multiple actions using GraphQL aliases for more information on GraphQL aliases.
Bulk mutations
When performing bulk mutations via GraphQL, it is crucial to set the X-Skedulo-Bulk-Operation
custom HTTP header value to true
on the GraphQL API request. This extra information lets Skedulo know the operation is part of a large bulk operation, giving it a chance to prioritize it accordingly (e.g., to process it in the background at a slower rate in order not to overload the system).
Example request:
curl --request POST \
--url https://api.skedulo.com/graphql/graphql \
--header 'Authorization: Bearer <auth_token>' \
--header 'Content-Type: application/json' \
--header 'X-Skedulo-Bulk-Operation: true' \
--data '{"query":"mutation { schema { insertJobs(input: { RegionId: \"000312b2-e568-4c09-b8b4-5e22127866df\"Description: \"Test Job\", Start: \"2024-02-06T10:00:00.000Z\", End: \"2024-02-06T11:00:00.000Z\", Duration: 60}) } }"}'
Important
If you perform a large-scale data import or mass-modify a large number of objects via GraphQL (e.g., importing thousands or tens of thousands of jobs over a short period of time), you must set theX-Skedulo-Bulk-Operation
HTTP header value to true
in the GraphQL API requests to protect the system.
Feedback
Was this page helpful?