Skip to content

Get a device's catalog

GET
/api/tenants/{tenant}/devices/{endpoint}/{device}/catalog
curl --request GET \
--url http://127.0.0.1:9090/api/tenants/acme/devices/office/CG0001/catalog \
--header 'Authorization: Basic <credentials>' \
--header 'X-Request-Id: 4f1c2b0e-8a7d-4c51-9e2f-3a6b8d0c1e7f'

What one device takes: the actions of its package that it takes and the commands it may be sent by name, as the package judges from what the device reported (firmware, capabilities), and the settings it has, each typed and described. Use it to build the params of POST /api/tenants/{tenant}/devices/{endpoint}/{device}/actions, and the values of a set_settings action.

tenant
required
string

The tenant’s id.

Example
acme
endpoint
required
string

The device’s endpoint.

Example
office
device
required
string

The device’s id.

Example
CG0001
X-Request-Id
string
<= 128 characters /^[A-Za-z0-9._:-]+$/

An id to follow the request by: answered back in X-Request-Id, and in the log, the audit trail and the events the request causes. 1 to 128 letters, digits, -, _, . or :; anything else is replaced by a new id.

Example
4f1c2b0e-8a7d-4c51-9e2f-3a6b8d0c1e7f

What the device takes, by the package that serves it.

Media typeapplication/json

What a device takes (GET /api/tenants/{tenant}/devices/{endpoint}/{device}/catalog).

object
actions
required

The actions the device takes, as the package judges from what the device reported.

Array<object>

An action the package offers: a standard one (GET /api/tenants/{tenant}/actions), or one of its own (standard false), which it expands into steps.

object
command

The command that is the action, when it is one; otherwise the package expands it into steps.

string | null
description

What the package says about how it does it, if anything.

string
name
required

The action’s name: what a request names to queue it.

string
params
required

The parameters it takes, typed: for a standard action, standard ones and the package’s own (x_...); for the package’s own action, those it declares.

Array<object>

One parameter: its name, type and what narrows it.

object
description

What it is. Absent when the package does not say.

string
items
One of:
null
max

integer: the largest value.

integer | null format: int64
max_bytes

binary: the most bytes, decoded.

integer | null
max_items

list, cards: the most items.

integer | null
max_length

string, secret: the most characters.

integer | null
min

integer: the smallest value.

integer | null format: int64
name
required

The parameter’s name, as a request gives it in params.

string
pattern

string, secret: a regular expression the whole value matches.

string | null
required

A request must give it. False unless said.

boolean
sensitive

A secret or personal data (a password, a card number, a template, a photo): it reaches the device in the payload and is kept and shown nowhere else, only as its size.

boolean
type
required

The kind of value it takes.

string
Allowed values: string integer boolean enum secret binary wall_time rfc3339 cards biometrics object list
values

enum: the values it may be.

Array<string>
standard
required

A standard action (true), or the package’s own (false): a vendor operation such as a firmware upgrade, with its own parameters.

boolean
writes
required

The sync domains it writes: the standard action’s, or what the package’s own action declares.

Array<string>
commands
required

The package’s commands the device takes.

Array<object>

A command the package declares: what it does, the parameters it takes, and what it writes on the device.

object
description
required

What it does.

string
implements

The standard action this command is, if it is one: it takes the standard parameters (GET /api/tenants/{tenant}/actions).

string | null
internal

Only a step of the package’s own actions: never sent by name.

boolean
key
required

Its name: what an action names to send it.

string
params
required

The parameters it takes, typed.

Array<object>

One parameter: its name, type and what narrows it.

object
description

What it is. Absent when the package does not say.

string
items
One of:
null
max

integer: the largest value.

integer | null format: int64
max_bytes

binary: the most bytes, decoded.

integer | null
max_items

list, cards: the most items.

integer | null
max_length

string, secret: the most characters.

integer | null
min

integer: the smallest value.

integer | null format: int64
name
required

The parameter’s name, as a request gives it in params.

string
pattern

string, secret: a regular expression the whole value matches.

string | null
required

A request must give it. False unless said.

boolean
sensitive

A secret or personal data (a password, a card number, a template, a photo): it reaches the device in the payload and is kept and shown nowhere else, only as its size.

boolean
type
required

The kind of value it takes.

string
Allowed values: string integer boolean enum secret binary wall_time rfc3339 cards biometrics object list
values

enum: the values it may be.

Array<string>
quick
required

Worth a one-click button: a hint for user interfaces.

boolean
sensitive_result
required

What the device answers may be sensitive (a file holding every user, say): once the command.result event carrying it is stored, the command keeps only its size.

boolean
success
required

Which result codes mean the command succeeded, unless the package says so itself.

string
Allowed values: zero non_negative positive
title
required

A short name for people.

string
writes
required

The sync domains it writes on the device (people, access, lists, settings, punches); empty for reads and device operations. A command that implements a standard action writes what that action writes.

Array<string>
device
required

The device’s id.

string
endpoint
required

The device’s endpoint.

string
package
required

The package that runs it, “name@version”.

string
revision

The revision of the package; null when it runs from a folder (hourd dev).

integer | null format: int32
settings
required

The settings the device has (set with the set_settings action).

Array<object>

A device setting the package registers: what set_settings and read_settings take, by its neutral name.

object
access
required

Rw (the default), w (set only) or r (read only).

string
depends_on_device

Whether a device has it depends on what the device reported (firmware, capabilities): the package’s applies(info), or values that are functions of info. A device’s own list says.

boolean
description
required

What it does.

string
max

integer, number: the largest value.

number | null format: double
max_length

string: the most characters.

integer | null
min

integer, number: the smallest value.

number | null format: double
name
required

The neutral name callers use (snake_case).

string
native
required

The name the device knows it by.

string
needs_reboot
required

The device takes it only after a restart.

boolean
pattern

string: a regular expression the value must match.

string | null
sensitive
required

Kept sealed and shown only as its size.

boolean
standard

The standard setting it is (volume), if it is one.

string | null
title

A short name for people. Absent when the package does not say.

string
type
required

Boolean, integer, number, string, enum or table.

string
values

enum: the values it may be.

Array<string>
Example
{
"actions": [
{
"command": "open_door",
"name": "open_door",
"params": [
{
"description": "Which door, as the device numbers them; default: its only one.",
"name": "door",
"required": false,
"sensitive": false,
"type": "string"
},
{
"description": "How long; default: the device's own unlock time.",
"name": "seconds",
"required": false,
"sensitive": false,
"type": "integer"
}
],
"standard": true,
"writes": []
}
],
"commands": [
{
"description": "Unlocks the door for a moment.",
"implements": "open_door",
"key": "open_door",
"params": [
{
"description": "Which door, as the device numbers them; default: its only one.",
"name": "door",
"required": false,
"sensitive": false,
"type": "string"
},
{
"description": "How long; default: the device's own unlock time.",
"max": 60,
"min": 1,
"name": "seconds",
"required": false,
"sensitive": false,
"type": "integer"
}
],
"quick": true,
"sensitive_result": false,
"success": "zero",
"title": "Open door",
"writes": []
}
],
"device": "CG0001",
"endpoint": "office",
"package": "[email protected]",
"revision": 7,
"settings": [
{
"access": "rw",
"description": "How loud the device speaks, in per cent.",
"max": 100,
"min": 0,
"name": "volume",
"native": "Volume",
"needs_reboot": false,
"sensitive": false,
"standard": "volume",
"title": "Volume",
"type": "integer"
}
]
}

A login is configured and the request carries neither it nor an API token, or it carries a wrong login (WWW-Authenticate: Basic realm="Hour Advantage", no body). Or the request carries an API token that is not one (revoked, or never made), login or not (WWW-Authenticate: Bearer realm="Hour Advantage", error="invalid_token", the body the API token was refused).

Media typetext/plain
string
Example
the API token was refused
WWW-Authenticate
string

The scheme to answer with: Basic realm="Hour Advantage", or for a refused token Bearer realm="Hour Advantage", error="invalid_token".

The Host header does not name a loopback address while one is required (no login configured, or the API listens on loopback), or the Origin header does not match the Host: {"error": ...} says which. Or no login is configured and the request carries Forwarded, X-Forwarded-For or X-Real-IP (a proxy forwarded it): the plain text body says so. Or an API token asks for a route its scope does not reach: the plain text body says so.

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
Example
{
"error": "the Host must name this machine (localhost or a loopback address); an API reached by other names needs the admin login"
}

The endpoint has no such device, or the endpoint is not configured.

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
Example
{
"error": "device not found"
}

More than 2 admin logins are being checked at once: send the request again after the Retry-After seconds. A request carrying the login that checked out last, or an API token, is not held up.

Media typetext/plain
string
Example
too many logins at once; try again
Retry-After
integer

Seconds to wait: 1.

Something went wrong in the gateway that asking again will not put right by itself; error says what.

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
Example
{
"error": "db error: ERROR: permission denied for table settings"
}

The database cannot be used right now (not reachable, too busy, no connection free in time), or the instance is still starting: send the same request again shortly. An API token that cannot be checked for the same reason is answered 503 in plain text (the API token cannot be checked right now; try again shortly).

Media typeapplication/json

A refusal, and why.

object
error
required

Why the request was refused, in a sentence.

string
fields

For a request whose parameters do not fit (422): what is wrong with each field. Absent otherwise.

Array<object>

What is wrong with one field of a request.

object
field
required

The parameter, as the request names it (values.volume for a setting inside values).

string
message
required

What is wrong with it.

string
request_id

The request’s id, as its X-Request-Id header gives it: what to quote when asking what happened to it.

string | null
Example
{
"error": "the gateway is starting; try again shortly"
}