Start a subtree of locations from a template
const url = 'https://example.com/api/v1/locations:createFromTemplate';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"label":"example","name":"example","parent":"example","template":"meeting-floor"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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.
Request Bodyrequired
Section titled “ Request Bodyrequired ”object
A URL to the JSON Schema for this object.
The subtree root’s label
The subtree root’s name; omitted takes the template’s, else its type’s name rule mints one
The location the subtree sits under, by name or dotted path; omitted makes it a new top
The location template, by name
Responses
Section titled “ Responses ”Created
object
A URL to the JSON Schema for this object.
The locations created, parents first
object
The location’s name
The location’s id, the stable address a link to it uses
The location it sits under, by name
Its location type
The standards this write created from their templates
The systems created in them
object
The location it sits in
The standard it is built to
The system’s name
The system’s id, the stable address a link to it uses
The template it came from; recorded in the audit detail only
The components that landed with no endpoint, still to attach
Example
{ "$schema": "/api/v1/schemas/CreateLocationsFromTemplateOutputBody.json"}default
Section titled “ default ”Error
object
A URL to the JSON Schema for this object.
A human-readable explanation specific to this occurrence of the problem.
Optional list of individual error details
object
Where the error occurred, e.g. ‘body.items[3].tags’ or ‘path.thing-id’
Error message text
The value at the given location
A URI reference that identifies the specific occurrence of the problem.
HTTP status code
A short, human-readable summary of the problem type. This value should not change between occurrences of the error.
A URI reference to human-readable documentation for the error.
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"}