Template

This endpoint is used to create, update, search or delete teamplates inside an organization.

Entity fields:

PathTypeDescription

data.type

string

Should be "template"

data.attributes.tcl

string

Terraform Configuration Language job template

data.attribute.name

string

Template name

data.attribute.description

string

Template description

data.attribute.version

string

Template version

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

Example:

{
  "data": {
    "type": "template",
    "attributes": {
      "name": "Some name",
      "description": "Some description",
      "version": "1.0.0",
      "tcl": "{{templateSample}}"
    }
  }
}

Supported Operations

Returns an instance of type template

GET/api/v1/organization/{organizationId}/template/{templateId}
Path parameters
organizationId*string

organization Identifier

templateId*string

template Identifier

Query parameters
Response

Successful response

Body
datatemplate (object)
includedarray of object

Included resources

Request
const response = await fetch('/api/v1/organization/{organizationId}/template/{templateId}', {
    method: 'GET',
    headers: {},
});
const data = await response.json();
Response
{
  "data": {
    "type": "text",
    "id": "text",
    "attributes": {
      "createdBy": "text",
      "createdDate": "2024-09-19T00:55:18.885Z",
      "description": "text",
      "name": "text",
      "tcl": "text",
      "updatedBy": "text",
      "updatedDate": "2024-09-19T00:55:18.885Z",
      "version": "text"
    },
    "relationships": {
      "organization": {
        "id": "text",
        "type": "organization"
      }
    }
  },
  "included": [
    {
      "id": "text",
      "type": "text"
    }
  ]
}

Creates an item of type template and adds it to template

POST/api/v1/organization/{organizationId}/template
Path parameters
organizationId*string

organization Identifier

Body
datatemplate (object)
Response

Successful response

Body
datatemplate (object)
Request
const response = await fetch('/api/v1/organization/{organizationId}/template', {
    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-19T00:55:18.885Z",
      "description": "text",
      "name": "text",
      "tcl": "text",
      "updatedBy": "text",
      "updatedDate": "2024-09-19T00:55:18.885Z",
      "version": "text"
    },
    "relationships": {
      "organization": {
        "id": "text",
        "type": "organization"
      }
    }
  }
}

Deletes an instance of type template

DELETE/api/v1/organization/{organizationId}/template/{templateId}
Path parameters
organizationId*string

organization Identifier

templateId*string

template Identifier

Response

Successful response

Request
const response = await fetch('/api/v1/organization/{organizationId}/template/{templateId}', {
    method: 'DELETE',
    headers: {},
});
const data = await response.json();

Modifies an instance of type template

PATCH/api/v1/organization/{organizationId}/template/{templateId}
Path parameters
organizationId*string

organization Identifier

templateId*string

template Identifier

Body
datatemplate (object)
Response

Successful response

Request
const response = await fetch('/api/v1/organization/{organizationId}/template/{templateId}', {
    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