### Starting a GraphQL Subscription Source: https://developer.skedulo.com/developer-guides/deskless-productivity-cloud/use-graphql/graphql-subscriptions Example of a 'start' message sent to the server to initiate a subscription. It includes a unique 'id', the GraphQL subscription 'query', and optional 'variables'. The query requests specific fields for 'schemaJobs'. ```json { "id": "1", "type": "start", "payload": { "query": "subscription {\n schemaJobs {\n operation\n timestamp\n data {\n UID\n Duration\n }\n previous {\n Duration\n }\n }\n}", "variables": {} } } ``` -------------------------------- ### POST /graphql - Query All Jobs Source: https://developer.skedulo.com/developer-guides/getting-started/quickstart Retrieves information about all jobs in the Skedulo organization using a GraphQL query. Returns job name and description fields for each job in the result set. ```APIDOC ## POST /graphql - Query All Jobs ### Description Retrieves all job objects from the Skedulo schema using a GraphQL query. Returns specified fields for each job, navigating through the object graph edges and nodes. ### Method POST ### Endpoint /graphql ### Request Body - **query** (string) - GraphQL query operation to retrieve jobs ### Query Fields - **Name** (string) - The name of the job - **Description** (string) - The description of the job ### Request Example ``` query allJobs { jobs { edges { node{ Name Description } } } } ``` ### Response #### Success Response (200) - **data** (object) - Response wrapper - **data.jobs** (object) - Jobs collection - **data.jobs.edges** (array) - Array of job edges - **data.jobs.edges[].node** (object) - Job node object - **data.jobs.edges[].node.Name** (string) - Job name - **data.jobs.edges[].node.Description** (string) - Job description ### Response Example ``` { "data": { "jobs": { "edges": [ { "node": { "Name": "Job Name" "Description": "This is a new job created using GraphQL" } } ] } } } ``` ``` -------------------------------- ### Dispatch Job using Skedulo REST API Source: https://developer.skedulo.com/developer-guides/getting-started/quickstart Dispatch a job to a specific resource by sending a POST request to the `/notifications/dispatch` endpoint with job and resource IDs. ```APIDOC ## Dispatch Job using Skedulo REST API ### Description This endpoint dispatches a job to a resource, triggering a notification (e.g., via SMS) to the resource. It requires the `jobId` and `resourceId` in the request payload. ### Method POST ### Endpoint `https://api.skedulo.com/notifications/dispatch` ### Parameters #### Headers - **Authorization** (string) - Required - Bearer token for authentication. e.g., `Bearer $AUTH_TOKEN` - **Content-Type** (string) - Required - `application/json` #### Request Body - **jobId** (string) - Required - The unique identifier of the job to dispatch. - **resourceId** (string) - Required - The unique identifier of the resource to assign the job to. ### Request Example ```bash curl --request POST \ --url https://api.skedulo.com/notifications/dispatch \ --header 'Authorization: Bearer $AUTH_TOKEN' \ --header 'Content-Type: application/json' \ --data '{ "jobId": "00149459-5115-4c86-8272-eb687d67c293", "resourceId": "0005310d-4383-40f0-a1f2-684c5e93cdbf" }' ``` ### Response #### Success Response (200) - **result** (object) - **jobId** (string) - The ID of the dispatched job. - **results** (array) - **resourceId** (string) - The ID of the resource. - **protocol** (string) - The notification protocol used (e.g., `sms`). - **error** (null) - Indicates no error occurred. #### Response Example ```json { "result": { "jobId": "00149459-5115-4c86-8272-eb687d67c293", "results": [ { "resourceId": "0005310d-4383-40f0-a1f2-684c5e93cdbf", "protocol": "sms", "error": null } ] } } ``` ``` -------------------------------- ### POST /graphql - Create a Job Source: https://developer.skedulo.com/developer-guides/getting-started/quickstart Creates a new job in Skedulo using the insertJobs GraphQL mutation. Jobs require a duration in minutes and a region ID. Optional fields include start/end times in ISO8601 format and a description. ```APIDOC ## POST /graphql - Create a Job ### Description Creates a new job in Skedulo with mandatory fields for duration and region assignment. Optionally includes date/time scheduling and job description. ### Method POST ### Endpoint /graphql ### Request Body - **Duration** (integer) - Required - The number of minutes allocated to complete the job - **RegionId** (string) - Required - The UID of the region where the job will be assigned - **Start** (string) - Optional - ISO8601 formatted date and time for job start - **End** (string) - Optional - ISO8601 formatted date and time for job end - **Description** (string) - Optional - Description of the job ### Request Example ``` mutation createJob{ schema { insertJobs(input: { Duration: 60 RegionId: "000396a9-ac46-4412-b015-b212af205f46" Start: "2021-09-10T06:00:00.000Z" End: "2021-09-10T07:00:00.000Z" Description: "This is a new job created using GraphQL" }) } } ``` ### Response #### Success Response (200) - **data** (object) - Response wrapper - **data.schema** (object) - Schema container - **data.schema.insertJobs** (string) - UID of the newly created job ### Response Example ``` { "data": { "schema": { "insertJobs": "00149459-5115-4c86-8272-eb687d67c293" } } } ``` ``` -------------------------------- ### GraphQL Query Response Example Source: https://developer.skedulo.com/developer-guides/deskless-productivity-cloud/use-graphql/graphiql A sample JSON response for the 'fetchRegions' GraphQL query, demonstrating the structure of data returned for regions in the Skedulo web application. ```json { "data": { "regions": { "edges": [ { "node": { "UID": "00030443-08b8-4612-a55a-75cb600e2729", "Name": "Brisbane" } }, { "node": { "UID": "00035c4b-f31a-45b8-88a8-73a1a863a293", "Name": "Sydney" } }, { "node": { "UID": "0003b50f-a43d-4e79-9d9d-4025357f5838", "Name": "Perth" } } ] } } } ``` -------------------------------- ### Create a Resource GraphQL Response Source: https://developer.skedulo.com/developer-guides/getting-started/quickstart JSON response from successful resource creation mutation containing the generated resource UID. This ID is required to assign the resource to jobs. ```json { "data": { "schema": { "insertResources": "0005310d-4383-40f0-a1f2-684c5e93cdbf" } } } ``` -------------------------------- ### Query All Jobs using GraphQL Query Source: https://developer.skedulo.com/developer-guides/getting-started/quickstart Retrieves all jobs from the Skedulo schema using a GraphQL query. Returns job details through edges and nodes structure, allowing selection of specific fields like Name and Description. ```graphql query allJobs { jobs { edges { node{ Name Description } } } } ``` -------------------------------- ### GraphQL Query Example: Fetch Regions Source: https://developer.skedulo.com/developer-guides/deskless-productivity-cloud/use-graphql/graphiql An example GraphQL query to retrieve region data, including UID and Name, from the Skedulo backend. This query can be executed within GraphiQL. ```graphql query fetchRegions { regions { edges { node { UID Name } } } } ``` -------------------------------- ### Delete Job using GraphQL Mutation Source: https://developer.skedulo.com/developer-guides/getting-started/quickstart Permanently remove a job from the system using the `deleteJobs` GraphQL mutation. ```APIDOC ## Delete Job using GraphQL Mutation ### Description This mutation permanently deletes an object from the Skedulo system. This action is irreversible and will cascade delete related objects. ### Method POST ### Endpoint /graphql ### Parameters #### Request Body ```json { "mutation": "mutation deleteJob {\n schema {\n deleteJobs(UID: \"your_job_id\")\n }\n}" } ``` ### Request Example ```json { "mutation": "mutation deleteJob {\n schema {\n deleteJobs(UID: \"00149459-5115-4c86-8272-eb687d67c293\")\n }\n}" } ``` ### Response #### Success Response (200) The response confirms the successful deletion of the job. #### Response Example (Response structure not explicitly defined in the source text, but implies success confirmation.) ```json { "data": { "schema": { "deleteJobs": "success" } } } ``` ### Notes - Deleting a job will also remove associated job allocations and the job will no longer appear in schedules. - Accessing the deleted job's URL will result in a "Job not found" error. ``` -------------------------------- ### POST /graphql - Create a Resource Source: https://developer.skedulo.com/developer-guides/getting-started/quickstart Creates a new resource in Skedulo using the insertResources GraphQL mutation. Resources are assigned to regions and carry out work. Requires name and region ID, with optional fields for resource type, notification preferences, and contact information. ```APIDOC ## POST /graphql - Create a Resource ### Description Creates a new resource that can be assigned to jobs within a specified region. Mandatory fields include resource name and primary region. Optional fields support notification configuration and contact details. ### Method POST ### Endpoint /graphql ### Request Body - **Name** (string) - Required - The name of the resource, typically first and last name - **PrimaryRegionId** (string) - Required - The UID of the region where the resource will work - **ResourceType** (string) - Optional - Type of resource: "Person" or non-human resource type - **NotificationType** (string) - Optional - Preferred notification method: "sms" or "push" - **MobilePhone** (string) - Optional - Phone number for SMS notifications - **CountryCode** (string) - Optional - Country code for the phone number (e.g., "AU") ### Request Example ``` mutation createResources { schema { insertResources(input: { Name: "Robert Resource" PrimaryRegionId: "000396a9-ac46-4412-b015-b212af205f46" ResourceType: "Person" NotificationType: "sms" MobilePhone: "0400123456" CountryCode: "AU" }) } } ``` ### Response #### Success Response (200) - **data** (object) - Response wrapper - **data.schema** (object) - Schema container - **data.schema.insertResources** (string) - UID of the newly created resource ### Response Example ``` { "data": { "schema": { "insertResources": "0005310d-4383-40f0-a1f2-684c5e93cdbf" } } } ``` ``` -------------------------------- ### GET /auth/config/team/web Source: https://developer.skedulo.com/skedulo-api This endpoint is used to determine the correct regional API subdomain for your Skedulo tenant by providing your team name. ```APIDOC ## GET /auth/config/team/web ### Description This endpoint is used to determine the correct regional API subdomain for your Skedulo tenant. You provide your team name, and the API returns the appropriate server API URL in its response. ### Method GET ### Endpoint `/auth/config/team/web` ### Query Parameters * **name** (string) - Required - The name of your Skedulo team. ### Request Example ```http GET https://api.skedulo.com/auth/config/team/web?name=my-team ``` ### Response #### Success Response (200) * **result** (object) - Contains the server API information. * **server** (object) - Contains the API endpoint details. * **api** (string) - The correct regional API subdomain URL for your tenant. #### Response Example ```json { "result": { "server": { "api": "https://api.us.skedulo.com" } } } ``` ``` -------------------------------- ### GraphQL Queries for Fetching Jobs and Products Source: https://developer.skedulo.com/developer-guides/create-and-manage-deployments/create-libraries/getting-started-with-libraries Defines GraphQL queries for fetching job and product data. The `fetchJobsWithJobProducts` query retrieves job details along with associated products, while `fetchProducts` fetches product information with pagination. These are essential for data retrieval operations within Skedulo extensions. ```graphql query fetchJobsWithJobProducts($filter: EQLQueryFilterJobs!) { jobs(filter: $filter) { edges { node { UID Name JobProducts { UID Qty Name JobId ProductId } } } } } query fetchProducts($orderBy: EQLOrderByClauseProducts, $filter: EQLQueryFilterProducts, $offset: NonNegativeInt) { page: products(orderBy: $orderBy, filter: $filter, offset: $offset) { totalCount edges { node { UID Name Description ProductCode } } } } ``` -------------------------------- ### Fetch GraphQL Schema with cURL Source: https://developer.skedulo.com/developer-guides/deskless-productivity-cloud/use-graphql/get-started-with-graphql Retrieve the full GraphQL Schema Definition Language specification for your Skedulo tenant. This requires an API access token and is performed via a GET request to the `/graphql/schema` endpoint. The response includes standard and custom objects, fields, and support for Geolocation. ```curl curl -X GET https://api.skedulo.com/graphql/schema -H "Authorization: Bearer $API_TOKEN" ``` -------------------------------- ### Update Job using GraphQL Mutation Source: https://developer.skedulo.com/developer-guides/getting-started/quickstart Modify existing schema objects, such as updating a job's address, using the `updateJobs` GraphQL mutation. ```APIDOC ## Update Job using GraphQL Mutation ### Description This mutation allows you to update existing objects within the Skedulo schema. For example, you can add an address to a job. ### Method POST ### Endpoint /graphql ### Parameters #### Request Body ```json { "mutation": "mutation updateJobs {\n schema {\n updateJobs(input: {\n UID: \"your_job_id\",\n Address: \"new job address\"\n })\n }\n}" } ``` ### Request Example ```json { "mutation": "mutation updateJobs {\n schema {\n updateJobs(input: {\n UID: \"00149459-5115-4c86-8272-eb687d67c293\",\n Address: \"47 Warner St, Fortitude Valley QLD 4006, Australia\"\n })\n }\n}" } ``` ### Response #### Success Response (200) The response indicates the success of the update operation. The exact structure may vary, but it typically confirms the update or returns relevant data. #### Response Example (Response structure not explicitly defined in the source text, but implies success confirmation.) ```json { "data": { "schema": { "updateJobs": "success" } } } ``` ### Notes - After updating the address, you may need to verify it in the Skedulo web application for geolocation purposes. - The `GeoLocation` scalar type can be used in subsequent EQL filters for distance-based queries once geolocation data is available. ``` -------------------------------- ### GraphQL Mutation to Create Product Source: https://developer.skedulo.com/developer-guides/deskless-productivity-cloud/interacting-with-apis/graphiql-connected-page This GraphQL mutation defines the structure for creating a new product. It takes a NewProducts input variable and uses the 'insertProducts' schema field to perform the insertion. Ensure the schema and field names match your API. ```graphql mutation createProduct($input: NewProducts!) { schema { insertProducts(input: $input) } } ``` -------------------------------- ### Query Jobs by ID using GraphQL Source: https://developer.skedulo.com/developer-guides/getting-started/quickstart Retrieve specific job details, including region and assigned resource, by using an EQL filter with a GraphQL query. ```APIDOC ## Query Jobs by ID using GraphQL ### Description This endpoint allows you to query for specific job information using GraphQL with an EQL filter to narrow down the results. It retrieves details such as name, duration, description, start/end times, region information, job status, and associated job allocations including resource details. ### Method POST ### Endpoint /graphql ### Parameters #### Request Body ```json { "query": "query jobsByID {\n jobs (filter: \"UID == 'your_job_id'\") {\n edges{\n node{\n Name\n Duration\n Description\n Start\n End\n Region {\n Name\n Timezone\n }\n JobStatus\n JobAllocations{\n Name\n Resource {\n UID\n Name\n }\n }\n }\n }\n }\n}" } ``` ### Request Example ```json { "query": "query jobsByID {\n jobs (filter: \"UID == '00149459-5115-4c86-8272-eb687d67c293'\") {\n edges{\n node{\n Name\n Duration\n Description\n Start\n End\n Region {\n Name\n Timezone\n }\n JobStatus\n JobAllocations{\n Name\n Resource {\n UID\n Name\n }\n }\n }\n }\n }\n}" } ``` ### Response #### Success Response (200) - **data** (object) - Contains the query results. - **jobs** (object) - **edges** (array) - **node** (object) - **Name** (string) - **Duration** (integer) - **Description** (string) - **Start** (string, ISO 8601 format) - **End** (string, ISO 8601 format) - **Region** (object) - **Name** (string) - **Timezone** (string) - **JobStatus** (string) - **JobAllocations** (array) - **Name** (string) - **Resource** (object) - **UID** (string) - **Name** (string) #### Response Example ```json { "data": { "jobs": { "edges": [ { "node": { "Name": "JOB-0185", "Duration": 60, "Description": "This is a new job created using GraphQL", "Start": "2021-09-10T06:00:00.000Z", "End": "2021-09-10T07:00:00.000Z", "Region": { "Name": "Brisbane CBD", "Timezone": "Australia/Brisbane" }, "JobStatus": "Pending Dispatch", "JobAllocations": [ { "Name": "JA-0727", "Resource": { "UID": "0005310d-4383-40f0-a1f2-684c5e93cdbf", "Name": "Robert Resource" } } ] } } ] } } } ``` ``` -------------------------------- ### Get Help for Local Package Deployment Source: https://developer.skedulo.com/developer-guides/cli/working-with-packages Displays the help information for the local package deployment command. This command provides details on all available options and arguments for deploying local packages using the Skedulo CLI. ```bash sked package deploy local --help ``` -------------------------------- ### GraphQL Queries for Fetching Jobs and Products Source: https://developer.skedulo.com/docs/customization/skedulo-sdk/library/library-getting-started Contains GraphQL queries for fetching job and product data. The `fetchJobsWithJobProducts` query retrieves details about jobs and their associated products, while `fetchProducts` fetches product information with optional filtering and ordering. These are essential for data retrieval operations within Skedulo libraries. ```graphql query fetchJobsWithJobProducts($filter: EQLQueryFilterJobs!) { jobs(filter: $filter) { edges { node { UID Name JobProducts { UID Qty Name JobId ProductId } } } } } query fetchProducts($orderBy: EQLOrderByClauseProducts, $filter: EQLQueryFilterProducts, $offset: NonNegativeInt) { page: products(orderBy: $orderBy, filter: $filter, offset: $offset) { totalCount edges { node { UID Name Description ProductCode } } } } ``` -------------------------------- ### GraphQL Query Variables for New Product Source: https://developer.skedulo.com/developer-guides/deskless-productivity-cloud/interacting-with-apis/graphiql-connected-page These are the variables required for the 'createProduct' mutation. The 'input' variable must be of type 'NewProducts' and include all necessary fields like Name, Description, ProductCode, and IsActive. Fields are case-sensitive. ```json { "input": { "Name": "New Product", "Description": "This is a new product", "ProductCode": "P-1", "IsActive": true } } ``` -------------------------------- ### POST /graphql - Assign Job to Resource Source: https://developer.skedulo.com/developer-guides/getting-started/quickstart Allocates a job to a resource using the insertJobAllocations GraphQL mutation. Requires both the job ID and resource ID to establish the assignment relationship. ```APIDOC ## POST /graphql - Assign Job to Resource ### Description Assigns an existing job to a resource using the insertJobAllocations mutation. This establishes the relationship between a job and a resource for work dispatch. ### Method POST ### Endpoint /graphql ### Request Body - **JobId** (string) - Required - The UID of the job to allocate - **ResourceId** (string) - Required - The UID of the resource to assign to the job ### Request Example ``` mutation allocateJob { schema { insertJobAllocations (input: { JobId: "00149459-5115-4c86-8272-eb687d67c293" ResourceId: "0005310d-4383-40f0-a1f2-684c5e93cdbf" }) } } ``` ### Response #### Success Response (200) - **data** (object) - Response wrapper - **data.schema** (object) - Schema container - **data.schema.insertJobAllocations** (string) - UID of the job allocation ### Error Handling - Verify both JobId and ResourceId are valid UIDs - Ensure the resource is assigned to the same region as the job - Check that the job and resource exist in the Skedulo organization ``` -------------------------------- ### Create a Job GraphQL Response Source: https://developer.skedulo.com/developer-guides/getting-started/quickstart JSON response from successful job creation mutation showing the generated job UID. This ID is used for subsequent operations like job allocation. ```json { "data": { "schema": { "insertJobs": "00149459-5115-4c86-8272-eb687d67c293" } } } ``` -------------------------------- ### Create a Job using GraphQL insertJobs Mutation Source: https://developer.skedulo.com/developer-guides/getting-started/quickstart Creates a new job in Skedulo using the insertJobs GraphQL mutation. Requires Duration (in minutes), RegionId, and optionally Start/End timestamps in ISO8601 format. Returns the UID of the newly created job. ```graphql mutation createJob{ schema { insertJobs(input: { Duration: 60 RegionId: "000396a9-ac46-4412-b015-b212af205f46" Start: "2021-09-10T06:00:00.000Z" End: "2021-09-10T07:00:00.000Z" Description: "This is a new job created using GraphQL" }) } } ``` -------------------------------- ### Assign Job to Resource using GraphQL insertJobAllocations Mutation Source: https://developer.skedulo.com/developer-guides/getting-started/quickstart Allocates a job to a resource using the insertJobAllocations GraphQL mutation. Requires JobId and ResourceId of previously created job and resource entities. ```graphql mutation allocateJob { schema { insertJobAllocations (input: { JobId: "00149459-5115-4c86-8272-eb687d67c293" ResourceId: "0005310d-4383-40f0-a1f2-684c5e93cdbf" }) } } ``` -------------------------------- ### sked function dev Examples Source: https://developer.skedulo.com/developer-guides/cli/command-reference/function/dev Illustrates how to use the 'sked function dev' command with specific examples. These examples demonstrate setting a port for the local server and specifying a custom local environment file. ```bash sked function dev ./test-directory -p 3000 ``` ```bash sked function dev ./test-directory -f .envlocal ``` -------------------------------- ### GraphQL Query with Filters and Limits Source: https://developer.skedulo.com/developer-guides/deskless-productivity-cloud/use-graphql/graphql-query-limits This example illustrates how to use the 'filter' and 'limit' parameters in a GraphQL query to retrieve specific job records. It filters jobs by 'JobStatus' and orders them by 'Start' time. ```graphql { jobs(limit: 1000, filter: "JobStatus == 'Queued'", orderBy: "Start ASC") { edges { node { UID Name JobStatus Start JobAllocations { UID Status } } } } } ```