Skip to content

Start a subtree of locations from a template

POST
/locations:createFromTemplate
curl --request POST \
--url https://example.com/api/v1/locations:createFromTemplate \
--header 'Content-Type: application/json' \
--data '{ "label": "example", "name": "example", "parent": "example", "template": "meeting-floor" }'

Creates a subtree of locations from a location template under a parent location (or as a new top), each location’s type checked against its parent type’s allowed parents as this fleet has them (your fork of a shipped type included), each named by the template, the request (the root) or its type’s name rule, and the systems the template puts in them, staffed as a system template is, unattached. One transaction: all of it or none, every piece in your own scope with its own audit row carrying from_template. Gated by location:create; when the subtree carries systems it also needs system:create, system:read, system:update, component:create and component:update, and standard:create when a standard is created from its template. A type this fleet does not hold, or a placement its types refuse, is a 422 naming the type or the pair.

Media type application/json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
label

The subtree root’s label

string
name

The subtree root’s name; omitted takes the template’s, else its type’s name rule mints one

string
parent

The location the subtree sits under, by name or dotted path; omitted makes it a new top

string
template
required

The location template, by name

string
>= 1 characters

Created

Media type application/json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
locations
required

The locations created, parents first

Array<object> | null
object
location
required

The location’s name

string
location_id
required

The location’s id, the stable address a link to it uses

string
parent

The location it sits under, by name

string
type
required

Its location type

string
standards_created
required

The standards this write created from their templates

Array<string> | null
systems
required

The systems created in them

Array<object> | null
object
location
required

The location it sits in

string
standard
required

The standard it is built to

string
system
required

The system’s name

string
system_id
required

The system’s id, the stable address a link to it uses

string
template
required

The template it came from; recorded in the audit detail only

string
to_attach
required

The components that landed with no endpoint, still to attach

Array<string> | null

Example

{
"$schema": "/api/v1/schemas/CreateLocationsFromTemplateOutputBody.json"
}

Error

Media type application/problem+json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
detail

A human-readable explanation specific to this occurrence of the problem.

string
errors

Optional list of individual error details

Array<object> | null
object
location

Where the error occurred, e.g. ‘body.items[3].tags’ or ‘path.thing-id’

string
message

Error message text

string
value

The value at the given location

instance

A URI reference that identifies the specific occurrence of the problem.

string format: uri
status

HTTP status code

integer format: int64
title

A short, human-readable summary of the problem type. This value should not change between occurrences of the error.

string
type

A URI reference to human-readable documentation for the error.

string format: uri
default: about:blank

Example

{
"$schema": "/api/v1/schemas/ErrorModel.json",
"detail": "Property foo is required but is missing.",
"instance": "https://example.com/error-log/abc123",
"status": 400,
"title": "Bad Request",
"type": "about:blank"
}