Skip to content
Suomi

Change a template or its steps

PATCH
/v1/projects/{projectId}/templates/{templateId}
Code sample: Shell / cURL
curl --request PATCH \
--url https://api.whatsbuilt.fi/v1/projects/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/templates/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "description": "example", "is_default": true, "fail_reason_list_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "steps": [ { "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "name": "example", "description": "example", "required": true, "sequential": true, "check_list_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "fail_reason_list_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } ] }'

Only the fields sent change. steps replaces the list: a step with id stays, one without is new, one left out goes. A step with recorded results cannot go (409 STEP_HAS_RESULTS). On a template in use, keep at least one existing step: a list with none of them answers 409 TEMPLATE_STEPS_STALE, an empty one 409 TEMPLATE_STEPS_REQUIRED. Open inspections follow the new steps at once. A change still being saved 25 seconds after the request arrived answers 400 VALIDATION_ERROR with the reason TIME_LIMIT in details and writes nothing: send fewer step changes at a time. A change whose added plus removed steps times the inspections that use the template exceed 30 000 answers 400 VALIDATION_ERROR with the reason TOO_LARGE in details at once, also writing nothing.

projectId
required
string format: uuid
templateId
required
string format: uuid
Media typeapplication/json

The body of updateTemplate.

object
name
string
>= 1 characters <= 255 characters
description
string
<= 20000 characters
is_default

Makes this the project’s default template

boolean
fail_reason_list_id
string | null format: uuid
steps

The whole list in its new order. A step with id keeps its results; a step left out is removed with its open results.

Array<object>
<= 100 items

A step of UpdateTemplateBody.

object
id

An existing step of this template; leave it out for a new step

string format: uuid
name
required
string
>= 1 characters <= 255 characters
description
string | null
<= 20000 characters
required

Default true

boolean
sequential

Default true: the step waits for the required steps before it

boolean
check_list_id

A check list of the project or the organisation; the step is then passed by its checks

string | null format: uuid
fail_reason_list_id
string | null format: uuid

The template

Media typeapplication/json

A live template.

object
id
required

The template.

string format: uuid
project_id
required

Null for the organisation’s own template

string | null format: uuid
organisation_id
required

Its organisation.

string format: uuid
name
required

Its name.

string
description
required

Its description.

string | null
is_default
required

Opened for an element that no plan covers

boolean
fail_reason_list_id
required

Its fail reasons.

string | null format: uuid
created_by
required

Who created it.

string | null
/^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/
created_at
required

When it was created.

string
modified_date
required

When it was changed last.

string
steps
required

Its steps.

Array<object>

A step of a template.

object
id
required

The step.

string format: uuid
sort_order
required

Its place.

integer format: int32
name
required

Its name.

string
description
required

Its description.

string | null
required
required

True when it must pass.

boolean
sequential
required

The step waits for the required steps before it

boolean
check_list_id
required

A step with a check list is passed by its checks

string | null format: uuid
fail_reason_list_id
required

Its fail reasons.

string | null format: uuid
changed_at
required

The row’s change time.

string
deleted
required
boolean

Example

{
"deleted": false
}

Invalid body, parameters or Idempotency-Key

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

Missing, malformed, expired or revoked token

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

INSUFFICIENT_SCOPE; INSUFFICIENT_PROJECT_ROLE when the project role the scopes give does not cover the write, or the project is not the integration’s; PUBLIC_API_DISABLED when the project’s owning organisation has turned the API off

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

No such project or template, or the template is the organisation’s own

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

STEP_HAS_RESULTS, TEMPLATE_STEPS_STALE, TEMPLATE_STEPS_REQUIRED or DEFAULT_TEMPLATE_CONFLICT

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

IDEMPOTENCY_KEY_REUSED: the key was used with another body

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

RATE_LIMITED; wait for Retry-After seconds

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}