Skip to content
Suomi

Add elements to the active plan of a template

POST
/v1/projects/{projectId}/inspection-plans/assign
Code sample: Shell / cURL
curl --request POST \
--url https://api.whatsbuilt.fi/v1/projects/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/inspection-plans/assign \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "template_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "plan_id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "global_ids": [ "example" ], "filter": { "ifc_type": [ "example" ], "storey_name": [ "example" ] }, "open_elsewhere": "skip", "dry_run": false, "partial": false }'

Up to 500 global_ids, or a filter that the plan’s scope takes. Elements outside the filter join as added plan elements; each gets its inspection and a label. One call handles at most 500 elements, fewer for a template of more than 12 steps. A list of more global_ids than that answers 400 VALIDATION_ERROR and writes nothing; details[0].maximum is the most ids one call takes under the template. With partial: true such a call handles the first taken ids instead, and remaining counts the ids after them: send those next. A filter call answers taken and remaining too: send the same filter until remaining is 0. With dry_run nothing is written and the counts come back. Several active plans on the template need plan_id.

projectId
required
string format: uuid
Media typeapplication/json

The body of assignInspectionPlanElements.

object
template_id
required
string format: uuid
plan_id

Required when several active plans use the template.

string format: uuid
global_ids
Array<string>
>= 1 items <= 50000 items
filter

The elements an assignment takes, by IFC type and storey name.

object
ifc_type
Array<string>
>= 1 items <= 100 items
storey_name
Array<string>
>= 1 items <= 100 items
open_elsewhere
string
default: skip
Allowed values: skip include
dry_run
boolean
partial

True handles the first taken ids of a list longer than one call takes; default false answers 400

boolean

The result

Media typeapplication/json

The answer of assignInspectionPlanElements, as the contract documents it.

One of:

A write.

object
plan
required

The plan an assign wrote to.

object
id
required
string format: uuid
name
required
string
created
required
boolean
saved_as
required

How the elements joined the plan.

string
Allowed values: filter elements covered
created
required
integer format: int32
adopted
required
integer format: int32
adopted_completed
required
integer format: int32
already_present
required
integer format: int32
skipped
required
integer format: int32
labels_created
required
integer format: int32
taken
required
integer format: int32
remaining
required
integer format: int32

Example

{
"saved_as": "filter"
}

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 plan, or a draft plan and the role is not admin

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

Several active plans use the template; send plan_id

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

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