Jobs

This endpoint is used to create, update, search or delete jobs for a particular Terrakube workspace.

Entity fields:

Path
Type
Description

data.type

string

Should be "job"

data.attributes.tcl

string

Terraform Configuration Language job template

data.attributes.templateReference

string

Terrakube template id to use when running the job

data.relationships.workspace.data.type

string

Should be "workspace"

data.relationships.workspace.data.Id

string

Should be the VCS Workspace Id (OPTIONAL)

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

Example:

{
  "data": {
    "type": "job",
    "attributes": {
      "tcl": "Base64 TCL job template"
      "templateReference": "XXXXXXXXX"
    },
    "relationships":{
        "workspace":{
            "data":{
                "type": "workspace",
                "id": "{{workspaceId}}"
            }
        }
    }
  }
}

Supported Operations

get

Returns an instance of type job

Path parameters
workspaceIdanyRequired

workspace Identifier

jobIdanyRequired

job Identifier

Query parameters
Responses
200
Successful response
application/vnd.api+json
get
GET /api/v1/workspace/{workspaceId}/job/{jobId} HTTP/1.1
Host: 
Accept: */*
200

Successful response

{
  "data": {
    "type": "text",
    "id": "text",
    "attributes": {
      "command": "plan",
      "output": "text",
      "status": "pending"
    },
    "relationships": {
      "organization": {
        "id": "text",
        "type": "organization"
      },
      "workspace": {
        "id": "text",
        "type": "workspace"
      }
    }
  },
  "included": [
    {
      "attributes": {},
      "id": "text",
      "relationships": {},
      "type": "text"
    }
  ]
}
post

Creates an item of type job and adds it to job

Path parameters
workspaceIdanyRequired

workspace Identifier

Body
Responses
201
Successful response
application/vnd.api+json
post
POST /api/v1/workspace/{workspaceId}/job HTTP/1.1
Host: 
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 217

{
  "data": {
    "type": "text",
    "id": "text",
    "attributes": {
      "command": "plan",
      "output": "text",
      "status": "pending"
    },
    "relationships": {
      "organization": {
        "id": "text",
        "type": "organization"
      },
      "workspace": {
        "id": "text",
        "type": "workspace"
      }
    }
  }
}
201

Successful response

{
  "data": {
    "type": "text",
    "id": "text",
    "attributes": {
      "command": "plan",
      "output": "text",
      "status": "pending"
    },
    "relationships": {
      "organization": {
        "id": "text",
        "type": "organization"
      },
      "workspace": {
        "id": "text",
        "type": "workspace"
      }
    }
  }
}
delete

Deletes an instance of type job

Path parameters
workspaceIdanyRequired

workspace Identifier

jobIdanyRequired

job Identifier

Responses
204
Successful response
delete
DELETE /api/v1/workspace/{workspaceId}/job/{jobId} HTTP/1.1
Host: 
Accept: */*
204

Successful response

No content

patch

Modifies an instance of type job

Path parameters
workspaceIdanyRequired

workspace Identifier

jobIdanyRequired

job Identifier

Body
Responses
204
Successful response
patch
PATCH /api/v1/workspace/{workspaceId}/job/{jobId} HTTP/1.1
Host: 
Content-Type: application/vnd.api+json
Accept: */*
Content-Length: 217

{
  "data": {
    "type": "text",
    "id": "text",
    "attributes": {
      "command": "plan",
      "output": "text",
      "status": "pending"
    },
    "relationships": {
      "organization": {
        "id": "text",
        "type": "organization"
      },
      "workspace": {
        "id": "text",
        "type": "workspace"
      }
    }
  }
}
204

Successful response

No content

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

Last updated

Was this helpful?