Schedule

This endpoint is used to create, update, search or delete schedules for a particular workspace inside an organization, this is useful when you need to create schedule task or running jobs in a particular time.

Entity fields:

PathTypeDescription

data.type

string

Should be "template"

data.attributes.cron

string

Cron expression to schedule a job inside a workspace. For more information please visit Quartz documentation.

data.attributes.tcl

string

Terrakube configuration language in base64

data.attributes.templateReference

string

Terrakube template id

To better understand Terrakube Configuration Language job templates please refer to the following GitHub repository.

Example:

{
  "data": {
    "type": "schedule",
    "attributes": {
      "cron": "0 0/1 * * * ?",
      "tcl": "{{templateSample}}"
    }
  }
}

Supported Operations

Returns an instance of type schedule

GET/api/v1/workspace/{workspaceId}/schedule/{scheduleId}
Path parameters
workspaceId*string

workspace Identifier

scheduleId*string

schedule Identifier

Query parameters
Response

Successful response

Body
dataschedule (object)
includedarray of object

Included resources

Request
const response = await fetch('/api/v1/workspace/{workspaceId}/schedule/{scheduleId}', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "data": {
    "type": "text",
    "id": "text",
    "attributes": {
      "createdBy": "text",
      "createdDate": "2024-09-16T19:40:11.987Z",
      "cron": "text",
      "description": "text",
      "enabled": false,
      "tcl": "text",
      "updatedBy": "text",
      "updatedDate": "2024-09-16T19:40:11.987Z"
    },
    "relationships": {
      "workspace": {
        "id": "text",
        "type": "workspace"
      }
    }
  },
  "included": [
    {
      "id": "text",
      "type": "text"
    }
  ]
}

Creates an item of type schedule and adds it to schedule

POST/api/v1/workspace/{workspaceId}/schedule
Path parameters
workspaceId*string

workspace Identifier

Body
dataschedule (object)
Response

Successful response

Body
dataschedule (object)
Request
const response = await fetch('/api/v1/workspace/{workspaceId}/schedule', {
    method: 'POST',
    headers: {
      "Content-Type": "application/vnd.api+json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();
Response
{
  "data": {
    "type": "text",
    "id": "text",
    "attributes": {
      "createdBy": "text",
      "createdDate": "2024-09-16T19:40:11.987Z",
      "cron": "text",
      "description": "text",
      "enabled": false,
      "tcl": "text",
      "updatedBy": "text",
      "updatedDate": "2024-09-16T19:40:11.987Z"
    },
    "relationships": {
      "workspace": {
        "id": "text",
        "type": "workspace"
      }
    }
  }
}

Deletes an instance of type schedule

DELETE/api/v1/workspace/{workspaceId}/schedule/{scheduleId}
Path parameters
workspaceId*string

workspace Identifier

scheduleId*string

schedule Identifier

Response

Successful response

Request
const response = await fetch('/api/v1/workspace/{workspaceId}/schedule/{scheduleId}', {
    method: 'DELETE',
    headers: {},
});
const data = await response.json();

Modifies an instance of type schedule

PATCH/api/v1/workspace/{workspaceId}/schedule/{scheduleId}
Path parameters
workspaceId*string

workspace Identifier

scheduleId*string

schedule Identifier

Body
dataschedule (object)
Response

Successful response

Request
const response = await fetch('/api/v1/workspace/{workspaceId}/schedule/{scheduleId}', {
    method: 'PATCH',
    headers: {
      "Content-Type": "application/vnd.api+json"
    },
    body: JSON.stringify({}),
});
const data = await response.json();

For a complete list of organization operation please visit the OpenAPI specification

Last updated