Custom objects and fields API

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

You can create custom objects and fields in Skedulo using the Skedulo Lens API. Editing custom objects and fields using the API is not supported.

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

See the Custom fields section of the Skedulo API Reference documentation for more information about using the /custom/standalone endpoints to create and edit custom objects and fields.

Prerequisite

You are an administrator and are properly authenticated to the Skedulo API.

Use the Custom API to create a custom object and field

Create a custom object with a unique ID field by calling the /custom/standalone/schemas endpoint and including the following information in the POST operation request body:

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

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

{
  "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
      }
    ]
  }
}

Add a custom field to an existing object

You can add a custom field to an existing object in the Skedulo library using the /custom/standalone/fields endpoint.

Custom fields can be unique fields, which acts as a secondary primary key and can be used to perform GraphQL upsert operations.

A unique field created with the Skedulo Lens API /custom/standalone/fields endpoint is automatically defined as valid for upsert operations.

To create a custom field, use a POST operation with the following example JSON payload:

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

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
  }
}