ops
5 个操作
GET /healthzLiveness and operational statusGET /v1/seq-gapsOpen sequence gaps of the tenant's devicesGET /v1/outboundOutbound delivery backlog of the tenantGET /v1/rejectionsRefused device messagesPOST /v1/telemetry/uiReport a page's web vitals and uncaught errors (browser beacon)
GET /healthz
Liveness and operational status
无需身份验证 · getHealth
Unauthenticated. Reports the outbound backlog per target, the watched certificates and, when the MQTT bridge runs, its connection state. In the read-only maintenance mode of the PostgreSQL cutover (#123) it also reports read_only; every other method of every route, and every audited read (the exports), then answers 503 with Retry-After.
响应
| 状态码 | 类型 | 说明 |
|---|---|---|
| 200 | Healthapplication/json | The service is up. |
| 400 | Errorapplication/json | The X-Request-Id header is present and malformed. |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
响应头
| 名称 | 状态码 | 类型 | 说明 |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 500 | string | Request id: the caller's |
响应示例
响应 200 · application/json
{
"ok": true,
"outbound_backlog": {
"national": 0
},
"certificates": []
}响应 400 · application/json
{
"error": "bad request id",
"code": "bad_request_id"
}响应 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}响应 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}GET /v1/seq-gaps
Open sequence gaps of the tenant's devices
身份验证:cookie, bearer, oauth2 · OAuth2 作用域:device_read · listSeqGaps
B9 (#21): the ranges of sequence numbers the tenant's devices have not sent yet, ascending by device and first missing number, one page (limit, default 50, at most 200; cursor from the previous page). A gap leaves the list when its messages arrive. Allowed for tenant_admin, auditor and platform_admin acting for the tenant, and an operator within its facilities (a device's facility, or its site when it has none). Not audited (a read). Not part of the partner SDK clients (x-not-in-sdk): SDK 0.2.0 was released before it.
参数
| 名称 | 位置 | 类型 | 说明 |
|---|---|---|---|
device_id可选 | query | string | Only the gaps of this device. |
limit可选 | query | integer | Page size: 1 to 200 gaps (default 50). |
cursor可选 | query | string | The previous page's |
响应
| 状态码 | 类型 | 说明 |
|---|---|---|
| 200 | SeqGapPageapplication/json | One page of open gaps. |
| 400 | Errorapplication/json | A bad |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin, auditor, platform_admin and an operator through a signed-in session or an operator API client) or tenant not allowed (X-Tenant). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
响应头
| 名称 | 状态码 | 类型 | 说明 |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 500 | string | Request id: the caller's |
响应示例
响应 200 · application/json
{
"items": [
{
"device_id": "scale-1",
"start_seq": 4,
"end_seq": 6,
"missing": 3,
"opened_at": 1790000000.5,
"alerted": true
}
],
"next_cursor": null
}响应 400 · application/json · device_id
{
"error": "bad device_id",
"code": "bad_device_id"
}响应 400 · application/json · limit
{
"error": "bad limit",
"code": "bad_limit"
}响应 400 · application/json · cursor
{
"error": "bad cursor",
"code": "bad_cursor"
}响应 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}响应 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}响应 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}响应 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}响应 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}响应 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}GET /v1/outbound
Outbound delivery backlog of the tenant
身份验证:cookie, bearer, oauth2 · OAuth2 作用域:tenant_read · getOutboundBacklog
B9 (#21): the tenant's events not yet delivered to each outbound target (national system, a buyer's EPCIS repository, an archive), with a tenant-neutral summary of the error of the event that failed most often (the full text for platform_admin only). Every configured target is listed, with zeros when nothing waits. Allowed for tenant_admin, auditor and platform_admin acting for the tenant. Not audited (a read). Not part of the partner SDK clients (x-not-in-sdk): SDK 0.2.0 was released before it.
响应
| 状态码 | 类型 | 说明 |
|---|---|---|
| 200 | OutboundBacklogapplication/json | The backlog per target. |
| 400 | Errorapplication/json | The X-Request-Id header is present and malformed. |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only tenant_admin, auditor and platform_admin) or tenant not allowed (X-Tenant). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
响应头
| 名称 | 状态码 | 类型 | 说明 |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 500 | string | Request id: the caller's |
响应示例
响应 200 · application/json
{
"targets": [
{
"target": "epcis",
"pending": 12,
"held": 1,
"failing": 12,
"next_attempt_at": 1790000960.5,
"max_attempts": 5,
"last_error": "HTTP 503"
},
{
"target": "file",
"pending": 0,
"held": 0,
"failing": 0,
"next_attempt_at": null,
"max_attempts": 0,
"last_error": null
}
]
}响应 400 · application/json
{
"error": "bad request id",
"code": "bad_request_id"
}响应 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}响应 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}响应 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}响应 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}响应 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}GET /v1/rejections
Refused device messages
身份验证:cookie, bearer · listRejections
B9 (#21): the device messages the server refused, newest first, one page (limit, default 50, at most 200; cursor from the previous page), never their payload (its size only). The record has no tenant (a refused message cannot be trusted to come from the tenant its route names), so the list is for platform_admin only, every tenant's; any other role is refused 403. Not audited (a read). Not part of the partner SDK clients (x-not-in-sdk): SDK 0.2.0 was released before it.
参数
| 名称 | 位置 | 类型 | 说明 |
|---|---|---|---|
reason可选 | query | string | Only messages refused for this reason. |
tenant可选 | query | string | Only messages whose route names this tenant (its first segment). |
limit可选 | query | integer | Page size: 1 to 200 messages (default 50). |
cursor可选 | query | string | The previous page's |
响应
| 状态码 | 类型 | 说明 |
|---|---|---|
| 200 | RejectionPageapplication/json | One page of refused messages. |
| 400 | Errorapplication/json | A bad |
| 401 | Errorapplication/json | No valid session, API token or legacy token. |
| 403 | Errorapplication/json | The caller is known but refused: role not permitted (only platform_admin) or tenant not allowed (X-Tenant). |
| 405 | Errorapplication/json | The path exists but not for this method. |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
响应头
| 名称 | 状态码 | 类型 | 说明 |
|---|---|---|---|
X-Request-Id | 200 | string | Request id: the caller's |
X-Request-Id | 400 | string | Request id: the caller's |
X-Request-Id | 401 | string | Request id: the caller's |
X-Request-Id | 403 | string | Request id: the caller's |
X-Request-Id | 405 | string | Request id: the caller's |
Allow | 405 | string | Comma-separated methods the path accepts. |
X-Request-Id | 500 | string | Request id: the caller's |
响应示例
响应 200 · application/json
{
"items": [
{
"id": 41,
"route": "coop-dl/ph1/scale-1/event/ObjectEvent",
"envelope_id": "3f2b8f0e-6a39-4f7e-9b1e-0d6c1c5e7a11",
"reason": "bad_signature",
"received_at": 1790000000.5,
"payload_bytes": 812
}
],
"next_cursor": null
}响应 400 · application/json · reason
{
"error": "bad reason",
"code": "bad_reason"
}响应 400 · application/json · tenant
{
"error": "bad tenant",
"code": "bad_tenant"
}响应 400 · application/json · limit
{
"error": "bad limit",
"code": "bad_limit"
}响应 400 · application/json · cursor
{
"error": "bad cursor",
"code": "bad_cursor"
}响应 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}响应 401 · application/json
{
"error": "missing or invalid token",
"code": "missing_or_invalid_token"
}响应 403 · application/json · role
{
"error": "role not permitted",
"code": "role_not_permitted"
}响应 403 · application/json · tenant
{
"error": "tenant not allowed",
"code": "tenant_not_allowed"
}响应 405 · application/json
{
"error": "method not allowed",
"code": "method_not_allowed"
}响应 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}POST /v1/telemetry/ui
Report a page's web vitals and uncaught errors (browser beacon)
无需身份验证 · postUiTelemetry
Anonymous (#81): the beacon a sampled page of the web app sends once when it is hidden or left (navigator.sendBeacon). A request carrying a session, token or cookie is treated like an anonymous one. In order: the /v1/public/* bucket and the telemetry bucket (bursts of 10, then 2 beacons a minute per client), keyed like the public routes; a Content-Length of 1 to 7 plain digits (400 invalid_beacon when it is missing or anything else, a chunked body included, before the body is read); a body of at most 1024 bytes (413 otherwise, before it is read); the body (UiTelemetryBeacon, strictly: an unknown field, a page kind outside the list, a measure that is not a number in range, more than 5 errors or nothing to report is 400 invalid_beacon). The beacon only adds to this process's counters and histograms, rendered by getMetrics; nothing is stored, logged or echoed, and its request log line names no peer address. It carries no personal data: a page kind, never the URL or an id; an error's kind and constructor name (names outside the standard ones count as other), never its message or stack. Not audited (AUDIT_EXEMPT: it changes no record, and an anonymous route must not append to the audit log). Every answer is no-store. Not part of the partner SDK clients (x-not-in-sdk): SDK 0.2.0 was released before it.
请求体
UiTelemetryBeacon (必填)
媒体类型: application/json
请求示例 · application/json
{
"page": "fruit",
"lcp_ms": 1834.2,
"cls": 0.02,
"inp_ms": 96,
"errors": [
{
"kind": "error",
"name": "TypeError"
}
]
}响应
| 状态码 | 类型 | 说明 |
|---|---|---|
| 204 | The beacon was counted. | |
| 400 | Errorapplication/json | A Content-Length that is missing or is not 1 to 7 plain digits (a chunked body included; |
| 413 | Errorapplication/json | The body is over 1024 bytes; the connection is closed. |
| 429 | Errorapplication/json | The client's public or telemetry bucket is empty: retry after |
| 500 | Errorapplication/json | Unexpected failure; the detail is only in the server log. |
响应头
| 名称 | 状态码 | 类型 | 说明 |
|---|---|---|---|
X-Request-Id | 204 | string | Request id: the caller's |
Cache-Control | 204 | string |
|
X-Request-Id | 400 | string | Request id: the caller's |
Cache-Control | 400 | string |
|
X-Request-Id | 413 | string | Request id: the caller's |
Cache-Control | 413 | string |
|
X-Request-Id | 429 | string | Request id: the caller's |
Cache-Control | 429 | string |
|
Retry-After | 429 | integer | Seconds until a token is back. |
X-Request-Id | 500 | string | Request id: the caller's |
响应示例
响应 400 · application/json · invalid_json
{
"error": "invalid JSON",
"code": "invalid_json"
}响应 400 · application/json · invalid_beacon
{
"error": "invalid beacon: unknown page",
"code": "invalid_beacon"
}响应 400 · application/json · bad_content_length
{
"error": "invalid beacon: bad content length",
"code": "invalid_beacon"
}响应 400 · application/json · bad_request_id
{
"error": "bad request id",
"code": "bad_request_id"
}响应 413 · application/json
{
"error": "body too large",
"code": "body_too_large"
}响应 429 · application/json
{
"error": "too many requests",
"code": "too_many_requests"
}响应 500 · application/json
{
"error": "internal error",
"code": "internal_error"
}