Ga naar inhoud

Test a source before saving it

POST
/api/v1/sources/test
curl --request POST \
--url https://example.com/api/v1/sources/test \
--header 'Content-Type: application/json' \
--cookie bl_%3Cslug%3E_session=%3Cbl_%3Cslug%3E_session%3E \
--data '{ "object": "example", "local_id": "example", "auth_header_value": "example", "provides": "example", "source_id": "example", "protocol": "example", "health_path": "example", "backend": { "base_url": "example", "auth_header_name": "example", "auth_header_value": "example", "allowed_methods": [ "example" ], "allowed_paths": [ "example" ], "links": { "additionalProperty": { "local_id": "example", "auth_header_value": "example", "provides": "example" } } } }'

As testing a saved source, for an address, key and health path that are not saved yet. A masked key is the saved one of source_id.

Media typeapplication/json

A system that is not saved yet (or saved with changes): its address, key and health path. A masked key is the stored one of source_id.

object
object

The building to test; left out: test the system itself.

string | null
local_id

The system’s own id of the building.

string | null
auth_header_value

A key for this building only; •••••• is the saved one.

string | null
provides

data, topology or both.

string | null
source_id

The saved source this is a changed version of: its masked key and koppelingen count.

string | null
protocol

buildinglinks (default) or generic.

string | null
health_path

A path on the system that says whether it is up, e.g. health.

string | null
backend

The binding of a dataset onto an internal API: where the data plane sends a request, with which key, and what it lets through.

object
base_url
required

The address of the system, e.g. https://bms.example.nl/api.

string
auth_header_name

The header that carries the key, e.g. X-Api-Key.

string | null
auth_header_value

The key; shown as ••••••, and sent back as such it stays as it was.

string | null
allowed_methods

Methods the data plane lets through, e.g. ["GET"] for reading or ["GET", "POST", "PATCH"] for reading and steering. At least one: an empty list lets nothing through.

Array<string>
allowed_paths

Path patterns the data plane lets through (* one segment, ** the rest), e.g. api/sites/4711/**, or ["**"] for the whole API. At least one, except on a Buildinglinks system, whose koppelingen fill them (v1/buildings/{object}/**): an empty list lets nothing through.

Array<string>
links

Koppelingen that differ from the default, per object (decisions #72): the data plane routes the building to the system’s own id and key.

object
key
additional properties

How one object is reached in a system (decisions #72).

object
local_id

The system’s own id of the building; the default is the object id.

string | null
auth_header_value

A key for this building only; the default is the system’s.

string | null
provides

What the system provides for this building: data (the default), topology (the indeling, decisions #71) or both.

string | null

Example generated

{
"object": "example",
"local_id": "example",
"auth_header_value": "example",
"provides": "example",
"source_id": "example",
"protocol": "example",
"health_path": "example",
"backend": {
"base_url": "example",
"auth_header_name": "example",
"auth_header_value": "example",
"allowed_methods": [
"example"
],
"allowed_paths": [
"example"
],
"links": {
"additionalProperty": {
"local_id": "example",
"auth_header_value": "example",
"provides": "example"
}
}
}
}

The outcome, also when the test failed (ok: false).

Media typeapplication/json

The outcome of a test of a system or a koppeling, as the UI shows it.

object
kind
required

system or koppeling.

string
ok
required
boolean
stage

Where it went wrong: unreachable, key, unknown, answer or invalid; null when ok.

string | null
status

The HTTP status of the system’s answer.

integer | null format: int32
ms
required

Milliseconds.

integer format: int64
message
string | null
request
required

The request as sent, without the key: method, url, header (its name).

object
response

What came back: status, content_type, body (at most 64 KiB), bytes, truncated.

object | null
object

Koppeling: the building, and its id in the system.

string | null
local_id
string | null
points

Koppeling: how many points and locations the system listed.

integer | null
locations
integer | null

Example generated

{
"kind": "example",
"ok": true,
"stage": "example",
"status": 1,
"ms": 1,
"message": "example",
"request": {},
"response": "example",
"object": "example",
"local_id": "example",
"points": 1,
"locations": 1
}

The request is not valid.

Media typeapplication/json

The body of every failed call to a management API.

object
error
required
object
code
required

Stable, machine-readable: invalid_request, unauthenticated, forbidden, not_found, conflict, upstream_unavailable, unavailable, internal, or a more specific code of the operation.

string
message
required

For people; may change between versions.

string

Example

{
"error": {
"code": "not_found",
"message": "unknown negotiation"
}
}

No valid session, DPoP-bound token or API key.

Media typeapplication/json

The body of every failed call to a management API.

object
error
required
object
code
required

Stable, machine-readable: invalid_request, unauthenticated, forbidden, not_found, conflict, upstream_unavailable, unavailable, internal, or a more specific code of the operation.

string
message
required

For people; may change between versions.

string

Example

{
"error": {
"code": "not_found",
"message": "unknown negotiation"
}
}

The caller lacks the role this operation needs; or a change with the session cookie came from a page of another site (cross_site_request, decisions #83).

Media typeapplication/json

The body of every failed call to a management API.

object
error
required
object
code
required

Stable, machine-readable: invalid_request, unauthenticated, forbidden, not_found, conflict, upstream_unavailable, unavailable, internal, or a more specific code of the operation.

string
message
required

For people; may change between versions.

string

Example

{
"error": {
"code": "not_found",
"message": "unknown negotiation"
}
}