How to: Manage Jobs

For information about prerequisites, see Integrate with Dispatch.

Create Job Attributes

To create Job Attributes, call the Post Job Attribute endpoint and pass the following required members in the request body:

MemberDescriptionRemarks
attributes > nameName of the attribute.string
minLength: 1
maxLength: 32
pattern: ^[a-zA-Z]{1,32}$
attributes > dataTypeData type of the attribute.string
Enum:
[ string, number, boolean, object, array ]
attributes > validation > range > min & maxField to specify the range that the attribute value must lie. In the case of the "string" datatype, the range will be the length of a string value. This validation allowed only for string and number type of attributes.number

Also, specify the jobTypeId in the path parameter.

The JSON request body should be similar to the following:

{
  "attributes": [
    {
      "name": "Pickup",
      "description": "Pickup Job",
      "tags": [
        "pick"
      ],
      "dataType": "string",
      "indexed": false,
      "defaultValue": {},
      "validation": {
        "range": {
          "min": 0,
          "max": 0
        },
        "regex": "string",
        "valueOneOf": [
          "string"
        ],
        "required": false
      }
    }
  ],
  "_event_meta": {}
}

Retrieve Job Attributes

To retrieve Job Attributes, call the Get Job Attribute endpoint and specify the jobTypeId in the path parameter.

Create a Job

To create a Job, call the Create Job endpoint and pass the following required members in the request body:

MemberDescriptionRemarks
jobWorkflowIdID of the Job Workflow.string
minLength: 1
maxLength: 64
objectives > objectiveRefReference ID for individual objectives.string
minLength: 4
maxLength: 36
objectives > locationLocation ID.string
minLength: 1
maxLength: 64
objectives > contactContact ID.string
minLength: 1
maxLength: 64
objectives > timeslot > from and toTime slot start and end time in UNIX epoch format.integer($int64)
minimum: 1
jobTypeIdID of the Job Type.string
minLength: 4
maxLength: 64
scheduledFor > startDateTimeDate time.number
assets > documentTypeType of documentation to be saved as an asset.string
assets > documentUrlURL of the documentation.string

The JSON request body should be similar to the following:

{
  "jobWorkflowId": "jobWorkflow:11daaaf3-c0b3-4f17-b6ba-6e27d487aaa9",
  "jobRef": "string",
  "objectives": [
    {
      "objectiveRef": "Pickup",
      "location": "location:abce4567-e89b-12d3-a456-426614174000",
      "contact": "string",
      "timeSlot": {
        "from": 1,
        "to": 1
      },
      "groupId": "string",
      "input": {
        "additionalProp1": {}
      }
    }
  ],
  "containers": [
    "string"
  ],
  "batchId": "string",
  "jobTypeName": "string",
  "jobTypeId": "string",
  "_event_meta": {},
  "scheduledFor": {
    "startDateTime": 0,
    "endDateTime": 0
  },
  "assets": [
    {
      "documentType": "string",
      "description": "string",
      "documentUrl": "string"
    }
  ],
  "orderId": "string",
  "workOrderId": "string",
  "additionalProp1": {}
}

Update a Job

To update a Job, call the Update Job endpoint and pass the following required members in the request body:

MemberDescriptionRemarks
jobRefJob Reference.string
minLength: 1
maxLength: 64
statusJob Status.string
Enum: [ COMPLETED ]

The JSON request body should be similar to the following:

{
  "jobRef": "string",
  "status": "COMPLETED",
  "subStatus": "string",
  "_event_meta": {},
  "orderId": "string"
}

To update a Job by Job ID, call the Update Job by Job ID endpoint and pass the following required members in the request body. Also, specify the jobId in the path parameter.

MemberDescriptionRemarks
scheduledFor > startDateTimeDate time.number
assets > documentTypeType of documentation to be saved as an asset.string
assets > documentUrlURL of the documentation.string
objectives > objectiveRefReference ID for individual objectives.string
minLength: 4
maxLength: 36
objectives > locationLocation ID.string
minLength: 1
maxLength: 64
objectives > contactContact ID.string
minLength: 1
maxLength: 64
objectives > timeslot > from and toTime slot start and end time in UNIX epoch format.integer($int64)
minimum: 1

The JSON request body should be similar to the following:

{
  "scheduledFor": {
    "startDateTime": 0,
    "endDateTime": 0
  },
  "assets": [
    {
      "documentType": "string",
      "description": "string",
      "documentUrl": "string"
    }
  ],
  "batchId": "string",
  "objectives": [
    {
      "objectiveRef": "string",
      "contact": "string",
      "timeSlot": {
        "from": 1,
        "to": 1
      },
      "groupId": "string"
    }
  ],
  "parentJobId": "string",
  "removeParentJob": true,
  "_event_meta": {}
}

Retrieve existing Jobs

To retrieve the existing Jobs, call the Get Job endpoint and specify the jobId in the path parameter.

Update the status and sub-status of Jobs

To update the status and sub-status of a Job, call the Change Status and Sub-Status of Job endpoint and pass the required members in the request body. Also, specify the jobId in the path parameter.

MemberDescriptionRemarks
statusJob status.string
Enum: [ COMPLETED ]

The JSON request body should be similar to the following:

{
  "status": "COMPLETED",
  "subStatus": "string",
  "_event_meta": {}
}

To update the sub-status of a Job, call the Change Sub-Status of Job endpoint and pass the required members in the request body. Also, specify the jobId in the path parameter.

MemberDescriptionRemarks
subStatusJob sub-status.string
maxLength: 64

The JSON request body should be similar to the following:

{
  "subStatus": "string",
  "_event_meta": {}
}

To update the sub-status of Jobs, call the Change Sub-Status of Jobs endpoint and pass the required members in the request body.

MemberDescriptionRemarks
jobs > jobIdJob ID.string
minLength: 1
maxLength: 64
jobs > subStatusJob sub-status.string
maxLength: 64

The JSON request body should be similar to the following:

{
  "jobs": [
    {
      "jobId": "string",
      "subStatus": "string"
    }
  ],
  "_event_meta": {}
}