Create custom objects and fields with the Skedulo API

Using the Skedulo API to create custom objects and unique fields.

You can create and delete custom objects and fields in the Skedulo Pulse Platform using the Skedulo API, however, editing custom objects and fields via the API is not supported. See the Custom fields section of the Skedulo API Reference documentation for more information about using the /custom endpoints.

Note that unique custom fields are required for performing upsert operations, and they must be created using the Custom fields API. To learn more about how to perform upsert GraphQL operations, see the GraphQL upserts documentation.

Prerequisite

You are an administrator or user with the appropriate permissions and are properly authenticated to the Skedulo API.

Create a custom object and field via the Custom API

To create a custom object with a unique ID field, make the following request:

Operation: POST

Endpoint: /custom/standalone/schemas

Example request body:

{
  "name": "NewCustomExternalObject",
  "label": "Custom External Object",
  "fields": [
    {
      "name": "Name",
      "column": {
        "type": "string"
      }
    },
    {
      "name": "UniqueID",
      "column": {
        "type": "string",
        "unique": true
      }
    }
  ]
}

Expected response:

{
  "result": {
    "schema": {
      "name": "NewCustomExternalObject",
      "description": null,
      "label": "Custom External Object",
      "mapping": "__newcustomexternalobject",
      "id": "aee80200-b04b-4a89-bbaf-bbf516f2d14d"
    },
    "fields": [
      ...
      {
        "id": "2998995f-9d31-4d7a-abc2-0dbb94e32ec0",
        "name": "UniqueID",
        "schemaName": "NewCustomExternalObject",
        "label": null,
        "description": null,
        "fieldType": "string",
        "mapping": "__uniqueid",
        "referenceSchemaName": null,
        "referenceSchemaFieldName": null,
        "required": false,
        "upsertKey": true,
        "accessMode": "read_write",
        "readOnly": false,
        "maxLength": 255,
        "precision": null,
        "scale": null
      }
    ]
  }
}

Note that the UniqueID field has the "upsertKey": true value in the JSON response, which indicates that this field can be used for GraphQL upsert operations.

Add a custom field to an existing object

Custom fields can be unique fields that act as a secondary key and can be used to perform GraphQL upsert operations. A unique field created with the Skedulo API /custom/standalone/fields endpoint is automatically defined as valid for upsert operations.

To create a custom field for an existing object, make the following request:

Operation: POST

Endpoint: /custom/standalone/fields

Example request body:

{
	"name": "NewCustomField",
	"schemaName": "Resources",
	"label": "NewCustomField",
	"description": "A new custom field on the Resources object.",
	"fieldType": "string",
	"column": {
		"type": "string",
		"unique": true
	}
}

Expected response:

Note that adding the "unique": true field to the request ensures that the new custom field can be upserted on, as indicated in the response that includes "upsertKey": true.

{
  "result": {
    "id": "e9d081a3-ec03-4515-847b-423465fff178",
    "name": "NewCustomField",
    "schemaName": "Resources",
    "label": "NewCustomField",
    "description": "A new custom field on the Resources object.",
    "fieldType": "string",
    "mapping": "__newcustomfield",
    "referenceSchemaName": null,
    "referenceSchemaFieldName": null,
    "required": false,
    "upsertKey": true,
    "accessMode": "read_write",
    "readOnly": false,
    "maxLength": 255,
    "precision": null,
    "scale": null
  }
}