Skip to content

Declare a metric on a location type

PUT
/location-types/{id}/metrics/{metric}
curl --request PUT \
--url https://example.com/api/v1/location-types/example/metrics/example \
--header 'Content-Type: application/json' \
--data '{ "default_value": "example", "required": true }'

Declares a catalog metric on a location type, or revises the declaration in place (the line is addressed by name, so the write is idempotent). A shipped (official) type’s contract is writable too: a contract line is a row in its own table and nothing seeds one, so every line is an operator’s. An unknown type is a 404 and a metric the catalog does not know is a 422. Gated by location_type:update.

id
required

The location type id

string

The location type id

metric
required

The metric name

string

The metric name

Media type application/json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
default_value

The contract default, validated against the metric’s data_type; omit for no default

required

Whether every location of this type must carry the metric; defaults to false

boolean

OK

Media type application/json
object
$schema

A URL to the JSON Schema for this object.

string format: uri
default_value

The contract default, a number shaped by the metric’s data_type; omitted when the contract sets none

metric_type_id
required

The catalog metric’s uuid, the stable form of metric_type_name

string
metric_type_name
required

The catalog metric this location type declares

string
required
required

Whether every location of this type must carry the metric

boolean
Example
{
"$schema": "/api/v1/schemas/LocationTypeMetricBody.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"
}