Skip to content
Suomi

Change one of the organisation's templates

PUT
/v1/organisation/templates/{id}
Code sample: Shell / cURL
curl --request PUT \
--url https://api.whatsbuilt.fi/v1/organisation/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": [ { "name": "example", "description": "example", "required": true, "sequential": true, "check_group_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "fail_reason_list_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" } ] }'

Inspections already opened keep the steps they started with. 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.

id
required
string format: uuid
Media typeapplication/json

The body of updateOrganisationTemplate.

object
name
string
<= 255 characters
description
string | null
<= 20000 characters
is_default
boolean
fail_reason_list_id
string | null format: uuid
steps

The whole list: a step with id is kept and changed, one without is added, one left out is removed

Array<object>
<= 100 items

A step of OrganisationTemplateChanges; with id it is kept and changed.

object
name
required
string
<= 255 characters
description
string | null
<= 20000 characters
required
boolean
default: true
sequential
boolean
default: true
check_group_id
string | null format: uuid
fail_reason_list_id
string | null format: uuid
id
string format: uuid

The template

Media typeapplication/json

shapeTemplate(): one of the organisation’s templates with its steps.

object
id
required
string format: uuid
name
required
string
description
required
string | null
applies_to_types
required
Array<string>
is_default
required
boolean
fail_reason_list_id
required
string | null format: uuid
created_by
required
string | null
created_at
required
string
modified_date
required
string
steps
required
Array<object>

A step of OrganisationTemplate.

object
id
required
string format: uuid
sort_order
required
integer format: int32
name
required
string
description
required
string | null
required
required
boolean
sequential
required
boolean
check_group_id
required
string | null format: uuid
fail_reason_list_id
required
string | null format: uuid

Example generated

{
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"name": "example",
"description": "example",
"applies_to_types": [
"example"
],
"is_default": true,
"fail_reason_list_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"created_by": "example",
"created_at": "example",
"modified_date": "example",
"steps": [
{
"id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"sort_order": 1,
"name": "example",
"description": "example",
"required": true,
"sequential": true,
"check_group_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"fail_reason_list_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"
}
]
}

Invalid body or parameters

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_ROLE when the principal is not an admin of its organisation; PUBLIC_API_DISABLED

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"
}

Not one of the organisation’s own; a project’s answers 404 here

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"
}

The template changed meanwhile, or a removed step has results

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"
}