Litmus Edge 4.4.x - DeviceHub: Subscriptions
Subscribe Browse Task Changed
POST {{edgeUrl}}/devicehub/v2
Subscribe Browse Task Changed
WebSocket subscription: run this over the GraphQL-over-WebSocket protocol at
wss://{{edgeHost}}/devicehub/v2(graphql-transport-ws). In Postman, create a WebSocket request and send the subscription as asubscribemessage payload -- a plain HTTP POST will not stream events.
WebSocket subscription. Convert to a Postman WebSocket request after import (URL: wss://.../devicehub/v2).
Endpoint
POST {{edgeUrl}}/devicehub/v2
Content-Type: application/json
Authentication
Two options. OAuth2 client credentials (recommended): send Authorization: Bearer <access token>. API key: send Authorization: Basic base64(<api key>:), that is, the API key as the username and an empty password. Create API keys and OAuth clients under System > Access Control. Each operation requires a permission scope; see the scope table in /le/devicehub/agents.md. The same credentials are valid across /devicehub/v2, /analytics/v2, /cc, /opcua, and the other LE services.
Request body (GraphQL)
subscription BrowseTaskChanged {
BrowseTaskChanged {
ID DeviceID DisplayName Status StatusDescription FoldersCount ItemsCount SizeOnDiskBytes
}
}
Errors
GraphQL endpoints return 200 OK even on logical errors. Inspect the errors array in the response body:
{ "errors": [ { "message": "...", "path": ["..."], "extensions": { "code": "..." } } ] }
extensions.code |
Meaning |
|---|---|
UNAUTHENTICATED |
Missing or invalid credentials. |
FORBIDDEN |
Credentials lack permission for this operation. |
BAD_USER_INPUT |
Invalid argument (wrong type, missing required field, malformed UUID, unknown ID, etc.). |
NOT_FOUND |
The targeted entity does not exist. |
INTERNAL_SERVER_ERROR |
DeviceHub fault. Retry, then escalate via System > Support. |
A non-200 HTTP response means DeviceHub itself is unreachable. See Dashboard > DeviceHub Status.
Values observed on LE 4.4.0: Status is Stopped (with StatusDescription Created) for a new task and Done once the crawl finished; see DeviceHub > Browse > List Browse Tasks for the status table.
TLS note: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.
Request Body
GraphQL Query
subscription BrowseTaskChanged {
BrowseTaskChanged {
ID DeviceID DisplayName Status StatusDescription FoldersCount ItemsCount SizeOnDiskBytes
}
}
Subscribe Device State Changed
POST {{edgeUrl}}/devicehub/v2
Subscribe Device State Changed
WebSocket subscription: run this over the GraphQL-over-WebSocket protocol at
wss://{{edgeHost}}/devicehub/v2(graphql-transport-ws). In Postman, create a WebSocket request and send the subscription as asubscribemessage payload -- a plain HTTP POST will not stream events.
WebSocket subscription. Subscribing first replays one State per existing device (a snapshot), then live changes follow. State enum: StartedConnected | StartedDisconnected | StartedUnknown | Stopped | Created | Starting | Stopping | Updated | Deleted | WDActivated | WDStopping | WDStarting.
Endpoint
POST {{edgeUrl}}/devicehub/v2
Content-Type: application/json
Authentication
Two options. OAuth2 client credentials (recommended): send Authorization: Bearer <access token>. API key: send Authorization: Basic base64(<api key>:), that is, the API key as the username and an empty password. Create API keys and OAuth clients under System > Access Control. Each operation requires a permission scope; see the scope table in /le/devicehub/agents.md. The same credentials are valid across /devicehub/v2, /analytics/v2, /cc, /opcua, and the other LE services.
Request body (GraphQL)
subscription DeviceStateChanged {
DeviceStateChanged {
ID State
}
}
Errors
GraphQL endpoints return 200 OK even on logical errors. Inspect the errors array in the response body:
{ "errors": [ { "message": "...", "path": ["..."], "extensions": { "code": "..." } } ] }
extensions.code |
Meaning |
|---|---|
UNAUTHENTICATED |
Missing or invalid credentials. |
FORBIDDEN |
Credentials lack permission for this operation. |
BAD_USER_INPUT |
Invalid argument (wrong type, missing required field, malformed UUID, unknown ID, etc.). |
NOT_FOUND |
The targeted entity does not exist. |
INTERNAL_SERVER_ERROR |
DeviceHub fault. Retry, then escalate via System > Support. |
A non-200 HTTP response means DeviceHub itself is unreachable. See Dashboard > DeviceHub Status.
TLS note: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.
Request Body
GraphQL Query
subscription DeviceStateChanged {
DeviceStateChanged {
ID State
}
}
Subscribe Search Task Changed
POST {{edgeUrl}}/devicehub/v2
Subscribe Search Task Changed
WebSocket subscription: run this over the GraphQL-over-WebSocket protocol at
wss://{{edgeHost}}/devicehub/v2(graphql-transport-ws). In Postman, create a WebSocket request and send the subscription as asubscribemessage payload -- a plain HTTP POST will not stream events.
WebSocket subscription. Reports search task progress in real time. Status is InProgress and then Done; Progress runs from 0 to 100.
Endpoint
POST {{edgeUrl}}/devicehub/v2
Content-Type: application/json
Authentication
Two options. OAuth2 client credentials (recommended): send Authorization: Bearer <access token>. API key: send Authorization: Basic base64(<api key>:), that is, the API key as the username and an empty password. Create API keys and OAuth clients under System > Access Control. Each operation requires a permission scope; see the scope table in /le/devicehub/agents.md. The same credentials are valid across /devicehub/v2, /analytics/v2, /cc, /opcua, and the other LE services.
Request body (GraphQL)
subscription SearchTaskChanged {
SearchTaskChanged {
ID Status Progress SearchedItemsCount
}
}
Errors
GraphQL endpoints return 200 OK even on logical errors. Inspect the errors array in the response body:
{ "errors": [ { "message": "...", "path": ["..."], "extensions": { "code": "..." } } ] }
extensions.code |
Meaning |
|---|---|
UNAUTHENTICATED |
Missing or invalid credentials. |
FORBIDDEN |
Credentials lack permission for this operation. |
BAD_USER_INPUT |
Invalid argument (wrong type, missing required field, malformed UUID, unknown ID, etc.). |
NOT_FOUND |
The targeted entity does not exist. |
INTERNAL_SERVER_ERROR |
DeviceHub fault. Retry, then escalate via System > Support. |
A non-200 HTTP response means DeviceHub itself is unreachable. See Dashboard > DeviceHub Status.
TLS note: edge devices use a self-signed certificate by default. Either install the device CA in your client trust store or disable certificate verification when calling this endpoint directly.
Request Body
GraphQL Query
subscription SearchTaskChanged {
SearchTaskChanged {
ID Status Progress SearchedItemsCount
}
}