Referencia GraphQL: command-delivery
Generada a partir del esquema que sirve este servicio, así que no puede quedarse atrás. El mismo esquema se publica como archivo para herramientas y agentes.
| Endpoint | https://<your-host>/api/command-delivery/graphql |
| Plano de autenticación | tenant — The ordinary application plane. Obtain a tenant access token by calling login then selectTenant on user-management, and authorize each call with the capability it names (for example device:write). |
| Autorización | tenant access token |
| Archivo del esquema | /schema/command-delivery.graphql |
| Descritos | 295 de 295 elementos |
La referencia que sigue se genera a partir del esquema y está solo en inglés.
Queries
campaign · campaignCycles · campaignElements · campaigns · commandBatches · commandBatchesById · commandBatchesByToken · commands · commandsById · commandsByToken · deviceCommandHold · drainableCommands
campaign
Returns one campaign by token, or null. Requires command:read and device:read.
Returns Campaign
| Argument | Type | Description |
|---|---|---|
token | String! | Token of the campaign. |
campaignCycles
Lists a campaign's cycles, newest first. Requires command:read and device:read. A SOLAR campaign also requires location:installed:read (or location:read).
Returns [CampaignCycle!]!
| Argument | Type | Description |
|---|---|---|
campaignToken | String! | Token of the campaign. |
limit | Int | Maximum cycles to return, 1 to 200. Absent or out of range means 50. |
campaignElements
Pages through a cycle's elements in id order. Requires command:read and device:read. A SOLAR campaign also requires location:installed:read (or location:read).
Returns [CampaignElement!]!
| Argument | Type | Description |
|---|---|---|
afterId | ID | Return elements after this id. Optional. |
campaignToken | String! | Token of the campaign. |
cycleKey | String! | Key of the cycle. |
limit | Int | Maximum elements to return, 1 to 1000. Absent or out of range means 200. |
status | String | Only elements in this status: PENDING, CLAIMED, DISPATCHED, REFUSED or SKIPPED. Optional; any other value is refused. |
campaigns
Lists the tenant's campaigns, newest first. Requires command:read and device:read.
Returns [Campaign!]!
| Argument | Type | Description |
|---|---|---|
limit | Int | Maximum campaigns to return, 1 to 200. Absent or out of range means 100. |
commandBatches
Searches the tenant's command batches, newest first, one page at a time. Requires command:read. Reading a batch that targeted a group additionally requires device:read.
Returns CommandBatchSearchResults!
| Argument | Type | Description |
|---|---|---|
criteria | CommandBatchSearchCriteria! | Filters and page to return. |
commandBatchesById
Returns the command batches with the given ids, in no particular order. Ids that match nothing are omitted; a non-numeric id is an error. Requires command:read. Reading a batch that targeted a group additionally requires device:read.
Returns [CommandBatch!]!
| Argument | Type | Description |
|---|---|---|
ids | [String!]! | Numeric ids of the batches, as strings. More than 1000 is refused with LIMIT_EXCEEDED. |
commandBatchesByToken
Returns the command batches with the given tokens, in no particular order. Tokens that match nothing are omitted. Requires command:read. Reading a batch that targeted a group additionally requires device:read.
Returns [CommandBatch!]!
| Argument | Type | Description |
|---|---|---|
tokens | [String!]! | Tokens of the batches. More than 1000 is refused with LIMIT_EXCEEDED. |
commands
Searches the tenant's commands, newest first, one page at a time. Requires command:read.
Returns CommandSearchResults!
| Argument | Type | Description |
|---|---|---|
criteria | CommandSearchCriteria! | Filters and page to return. |
commandsById
Returns the commands with the given ids, in no particular order. Ids that match nothing are omitted; a non-numeric id is an error. Requires command:read.
Returns [Command!]!
| Argument | Type | Description |
|---|---|---|
ids | [String!]! | Numeric ids of the commands, as strings. More than 1000 is refused with LIMIT_EXCEEDED. |
commandsByToken
Returns the commands with the given tokens, in no particular order. Tokens that match nothing are omitted. Requires command:read.
Returns [Command!]!
| Argument | Type | Description |
|---|---|---|
tokens | [String!]! | Tokens of the commands. More than 1000 is refused with LIMIT_EXCEEDED. |
deviceCommandHold
Reports whether a device is disabled and how many commands are held for it (see
DeviceCommandHold). Answers for any device token: an unknown or enabled device reports
disabled: false, heldCount: 0. Requires command:read.
Returns DeviceCommandHold!
| Argument | Type | Description |
|---|---|---|
deviceToken | String! | Token of the device. |
drainableCommands
Returns a device's still-waiting commands (HELD and PARKED) that have not expired, oldest first, for a transport delivering the backlog when the device comes back. Dispatch the list in the order given. Empty when nothing is waiting. Requires command:claim, a system-tier authority: tenant user tokens cannot call it.
Returns [Command!]!
| Argument | Type | Description |
|---|---|---|
deviceToken | String! | Token of the device whose backlog to read. |
limit | Int | Maximum commands to return. Absent, null or 0 or less means 32; values above 1000 are capped at 1000. A device with more waiting returns the rest on a later call. |
Mutations
acknowledgeCommandDelivery · cancelCommand · cancelCommandBatch · cancelDeviceCommands · confirmCommandDispatch · createCampaign · createCommand · createCommandBatch · deleteCampaign · markCommandSent · parkCommand · pullCommands · releaseHeldCommands · respondToPulledCommand · retryCampaignFailed · retryCommandBatch · setCampaignEnabled
acknowledgeCommandDelivery
For the HTTP pull channel: records that the device acknowledged a command a pull handed it, which sets the command's deliveredTime and deliveryEvidence (DEVICE_ACK) and settles a ONEWAY command as SUCCESSFUL. Idempotent. Answers RECORDED (this call recorded it, or an earlier one did), NOT_FOUND (no such command for the device), NOT_PULLED (the command was never handed to a pull), or NOT_AWAITING (the command is already finished without a delivery, for instance failed as NOT_DELIVERED). Requires command:claim, a system-tier authority.
Returns String!
| Argument | Type | Description |
|---|---|---|
deviceToken | String! | Token of the device that acknowledged. |
token | String! | Token of the command. |
cancelCommand
Cancels a command the platform still holds (QUEUED, HELD or PARKED) and returns it. A command in any other state is returned unchanged, so check the status you get back: a SENT command is already at the device and cannot be recalled. An unknown token is an error. Requires command:write.
Returns Command!
| Argument | Type | Description |
|---|---|---|
token | String! | Token of the command to cancel. |
cancelCommandBatch
Calls off a fleet write: stops every command of the batch the platform still holds (QUEUED, HELD or PARKED) and reports what it did. Commands already sent cannot be recalled. An unknown batch token is an error. Requires command:write, and also device:read when the batch targeted a group.
Returns CancelCommandBatchResult!
| Argument | Type | Description |
|---|---|---|
token | String! | Token of the batch to cancel. |
cancelDeviceCommands
Cancels every command the platform still holds for one device (QUEUED, HELD or PARKED) and
reports how many. Commands already sent cannot be recalled and are not touched. It is
cancelCommand over a device, and the way to discard what a disabled device was holding.
Requires command:write.
Returns CancelDeviceCommandsResult!
| Argument | Type | Description |
|---|---|---|
deviceToken | String! | Token of the device. |
confirmCommandDispatch
For a transport that received a command on the live delivery stream: confirms, just before actuating, that the delivery is still the dispatch the platform holds. Returns a new dispatch nonce to quote when reporting the outcome, or null when the delivery is stale (re-armed, re-sent, answered, cancelled or its batch cancelled) or its maintenance window has closed, in which case discard it without actuating. A command refused because its window closed is moved back to PARKED, to be delivered in the next opening. Requires command:claim, a system-tier authority.
Returns String
| Argument | Type | Description |
|---|---|---|
dispatchNonce | String! | The dispatch nonce carried in the delivery. |
token | String! | Token of the command. |
createCampaign
Creates a campaign. A refused definition comes back as a rejection. Requires command:write and device:read. A SOLAR campaign also requires location:installed:read (or location:read).
Returns CreateCampaignResult!
| Argument | Type | Description |
|---|---|---|
request | CampaignCreateRequest! | The campaign to create. |
createCommand
Issues a command to one device. Returns the created command, or a typed rejection when the request is refused; a GraphQL error means the enqueue could not be decided at all. Re-sending a token you already used returns the original command. Requires command:write.
Returns CreateCommandResult!
| Argument | Type | Description |
|---|---|---|
request | CommandCreateRequest! | The command to issue. |
createCommandBatch
Issues one command to many devices, named explicitly or resolved from an entity group, as a single recorded and cancellable operation. Returns the batch or a typed rejection; a GraphQL error means the batch could not be decided and nothing was created, so the token is unspent and the request can be retried. Requires command:write, and also device:read when targeting a group.
Returns CreateCommandBatchResult!
| Argument | Type | Description |
|---|---|---|
request | CommandBatchCreateRequest! | The batch to issue. |
deleteCampaign
Deletes a campaign and cancels the commands it had planned but not sent. Commands already created are untouched, and an element whose batch was being sent is recorded from that batch, not as cancelled. There is no update: to change a campaign, delete it and create it again. Requires command:write and device:read.
Returns Boolean!
| Argument | Type | Description |
|---|---|---|
token | String! | Token of the campaign. |
markCommandSent
For a transport that dispatches a backlog itself: claims a QUEUED, HELD or PARKED command for immediate delivery and moves it to SENT. Claim before dispatching. Returns the dispatch nonce, which must be quoted back when reporting the outcome; returns null if the command could not be claimed (already sent, answered or cancelled). Requires command:claim, a system-tier authority.
Returns String
| Argument | Type | Description |
|---|---|---|
token | String! | Token of the command to claim. |
parkCommand
For a transport that found the device unreachable: hands a SENT command back, moving it to PARKED to be delivered on the device's next wake. Returns false, a settled outcome that must not be retried, when the command moved on (answered, cancelled, expired or re-claimed) or the nonce names a superseded dispatch. Requires command:park, a system-tier authority.
Returns Boolean!
| Argument | Type | Description |
|---|---|---|
dispatchNonce | String! | The dispatch nonce carried in the delivery this command arrived in. |
token | String! | Token of the command. |
pullCommands
For the HTTP pull channel: hands a device the commands it may be sent, oldest first, and claims each one (QUEUED, HELD or PARKED to SENT) in the same conditional update markCommandSent uses, so two pulls can never both be handed one. A command an earlier pull handed out and never saw acknowledged for 60 seconds is handed out again, until its maxAttempts are spent; a command whose attempts are spent is first failed as NOT_DELIVERED. Requires command:claim, a system-tier authority; the caller must already have authenticated the device.
Returns [PulledCommand!]!
| Argument | Type | Description |
|---|---|---|
deviceToken | String! | Token of the device pulling. |
limit | Int | At most this many commands, up to 16. Omit it for 16. |
releaseHeldCommands
Returns a device's HELD commands to the delivery queue (QUEUED) because the device has come back, and returns how many were released; zero when nothing was waiting. It queues rather than delivers: the delivery sweep still decides whether each command goes out. Requires command:wake, a system-tier authority.
Returns Int!
| Argument | Type | Description |
|---|---|---|
deviceToken | String! | Token of the device that came back. |
respondToPulledCommand
For the HTTP pull channel: records the device's answer to a command a pull handed it, settling it as SUCCESSFUL or FAILED and recording delivery evidence (DEVICE_RESPONSE) if no acknowledgement came first. Idempotent for a command that is already finished. Answers RECORDED, NOT_FOUND, NOT_PULLED, or NOT_ANSWERABLE (the command is not awaiting an answer from this device). Requires command:claim, a system-tier authority.
Returns String!
| Argument | Type | Description |
|---|---|---|
deviceToken | String! | Token of the device that answered. |
error | String | Why the device did not carry the command out. Optional. |
payload | String | The device's answer payload as text. At most 65536 bytes. Optional. |
success | Boolean! | True if the device carried the command out. |
token | String! | Token of the command. |
retryCampaignFailed
Re-sends a cycle's command to the elements that did not succeed, through the batch retry, so a device whose command is in flight or already succeeded is never sent a second copy, and one whose outcome is unknown is sent one only with includeUnknown. Requires command:write and device:read. A SOLAR campaign also requires location:installed:read (or location:read).
Returns CampaignRetryResult!
| Argument | Type | Description |
|---|---|---|
campaignToken | String! | Token of the campaign. |
cycleKey | String! | Key of the cycle. |
includeUnknown | Boolean! | Whether to also re-send elements whose command may already have acted. |
retryCommandBatch
Re-issues a batch's command to a chosen subset of its devices that did not succeed, as a new batch linked to the original. The server copies the command name and payload from the original and re-validates every device exactly as a fresh batch does (disabled devices, the command vocabulary, the held-command ceiling). Each device must be a member of the original and NOT_DELIVERED or REJECTED; UNKNOWN only with includeUnknown. Refused with RETRY_ORIGINAL_NOT_FOUND, RETRY_NO_TARGETS, RETRY_NOT_A_MEMBER, RETRY_NOT_ELIGIBLE, RETRY_UNKNOWN_NOT_ACKNOWLEDGED or RETRY_TOKEN_IN_USE, or with any code createCommandBatch refuses with. Requires command:write, and also device:read when the original targeted a group.
Returns CreateCommandBatchResult!
| Argument | Type | Description |
|---|---|---|
request | CommandBatchRetryRequest! | The retry to issue. |
setCampaignEnabled
Switches a campaign on or off and returns it. Requires command:write and device:read.
Returns Campaign!
| Argument | Type | Description |
|---|---|---|
enabled | Boolean! | Whether the campaign should run. |
token | String! | Token of the campaign. |
Objects
Campaign · CampaignCycle · CampaignCycleCounts · CampaignElement · CampaignRetryResult · CampaignStep · CancelCommandBatchResult · CancelDeviceCommandsResult · Command · CommandBatch · CommandBatchDeviceRefusal · CommandBatchRefusalCount · CommandBatchRejection · CommandBatchSearchResults · CommandEnqueueRejection · CommandSearchResults · CreateCampaignResult · CreateCommandBatchResult · CreateCommandResult · DeviceCommandHold · PulledCommand · SearchResultsPagination
Campaign
object
A scheduled, tracked fan-out of command steps to the devices of an entity group. It is a definition: each time its trigger fires it plans a cycle, and a cycle holds one element per device per step, so which devices did not receive a command, and why, is a query. A campaign is not edited in place: to change one, delete it and create it again. The new campaign sends nothing that fell due before it was created.
| Field | Type | Description |
|---|---|---|
createdAt | String | When the campaign was created, as an RFC 3339 timestamp. |
enabled | Boolean! | False when the campaign is switched off: it plans and sends nothing. Switched back on, it does not send what fell due while it was off. |
expiresInSeconds | Int! | Time-to-live, in seconds, of each command the campaign creates. |
groupToken | String! | Token of the entity group whose devices the campaign targets. |
id | ID! | Server-assigned numeric identifier, as a string. |
lastError | String | Why the last planning attempt failed; null when it succeeded. |
maxLatenessSeconds | Int! | How late, in seconds, a planned command may still be sent. Later ones are skipped as MISSED. |
name | String | Human-readable name; null when none is set. |
plannedThrough | String | The instant up to which cycles have been planned; null before the first plan. |
steps | [CampaignStep!]! | The command steps, in order. |
targetKind | String! | Kind of target. Always GROUP in this release. |
token | String! | Identifier of the campaign, unique within the tenant. |
trigger | String! | The trigger as a JSON document: kind (CRON, CALENDAR or SOLAR), zone, and the fields of that kind (cron; dates and times; event and offsetMinutes), plus optional holidays. |
updatedAt | String | When the campaign was last written, as an RFC 3339 timestamp. |
CampaignCycle
object
One firing of a campaign.
| Field | Type | Description |
|---|---|---|
at | String | The fire instant of a CRON or CALENDAR cycle; null for SOLAR, whose instant is per device. |
counts | CampaignCycleCounts! | Where the cycle's elements and their commands stand now. |
createdAt | String | When the cycle was planned, as an RFC 3339 timestamp. |
day | String | The local civil date (YYYY-MM-DD) of a SOLAR cycle; null otherwise. |
key | String! | Stable key of the firing; pass it as cycleKey. |
resolved | Int! | How many devices the group held when the cycle was planned. |
CampaignCycleCounts
object
Where a cycle stands. The first five count elements by campaign state; the rest count the commands behind the dispatched elements, by what the latest command for each did.
| Field | Type | Description |
|---|---|---|
claimed | Int! | Due and being sent. |
dispatched | Int! | Sent: a command was created. |
failed | Int! | Commands that finished without success and are safe to send again. |
inFlight | Int! | Commands not yet finished. |
pending | Int! | Planned and not yet due. |
refused | Int! | Not admitted by the command batch (vocabulary, ceiling, maintenance window...). |
skipped | Int! | Never commanded: NO_SITE, POLAR_DAY, POLAR_NIGHT, MISSED, CANCELLED, PREDATES_CAMPAIGN, DISABLED, SUPERSEDED or NOT_IN_GROUP. |
succeeded | Int! | Commands that succeeded. |
unknown | Int! | Commands that finished with an outcome that cannot be vouched for; a retry needs includeUnknown. |
waiting | Int! | Of the in-flight commands, how many are held for a maintenance window. |
CampaignElement
object
One device's step in one cycle.
| Field | Type | Description |
|---|---|---|
batchToken | String | Token of the batch that carried the command; null before it is sent. |
commandOutcome | String | Outcome class of that command once finished: SUCCEEDED, NOT_DELIVERED, REJECTED or UNKNOWN. |
commandStatus | String | Status of the latest command for the element; null when it has none. |
deviceToken | String! | Token of the device. |
dueAt | String! | When the element falls due, as an RFC 3339 timestamp. |
id | ID! | Server-assigned numeric identifier; pass the last one on a page as afterId. |
reason | String | Why the element is REFUSED (the batch's refusal code) or SKIPPED: NO_SITE, POLAR_DAY or POLAR_NIGHT (no event to fire at), MISSED (not sent within maxLatenessSeconds), CANCELLED (the campaign was deleted), PREDATES_CAMPAIGN (due before the campaign was created), DISABLED (due while the campaign was switched off), SUPERSEDED (a newer firing of the same step for the same device was due at the same time, and only the newest was sent) or NOT_IN_GROUP (the device had left the group when the cycle fell due). |
retryBatchToken | String | Token of the batch a retry re-sent it in; null when it was not retried. |
status | String! | PENDING, CLAIMED, DISPATCHED, REFUSED or SKIPPED. |
step | Int! | Zero-based index of the step. |
CampaignRetryResult
object
What a retry-from-failed did.
| Field | Type | Description |
|---|---|---|
batches | [String!]! | Tokens of the retry batches created or replayed. |
held | Int! | How many were left alone because re-sending is unsafe: still in flight, or unknown without includeUnknown. |
retried | Int! | How many elements were re-sent. |
CampaignStep
object
One step of a campaign.
| Field | Type | Description |
|---|---|---|
delaySeconds | Int! | Seconds after the trigger at which the step fires, per device. |
name | String | The command name. |
payload | String | The command payload as a JSON document; null when none. |
type | String! | COMMAND. |
CancelCommandBatchResult
object
What cancelling a batch was able to do. The four counts are not guaranteed to sum to matched; if matched exceeds their sum, some commands returned to the delivery queue after the cancel, and calling cancelCommandBatch again stops them.
| Field | Type | Description |
|---|---|---|
alreadyFinished | Int! | Commands that had already succeeded, failed, timed out, expired or been cancelled before this call. Nothing to do. |
alreadySent | Int! | Commands already handed to their devices. They cannot be recalled and the devices will still act on them. |
cancelled | Int! | Commands the platform still held and has now stopped. They will not be delivered. |
matched | Int! | How many of the batch's commands exist right now. May be lower than the batch's accepted count, because commands can be deleted. |
CancelDeviceCommandsResult
object
What cancelDeviceCommands did.
| Field | Type | Description |
|---|---|---|
cancelled | Int! | Commands the platform still held for the device and has now cancelled. |
Command
object
A persisted command to one device. It is stored when accepted and moves through the lifecycle states in status until it settles; it is never fire-and-forget.
Implements Model, TokenReference, MetadataEntity
| Field | Type | Description |
|---|---|---|
batchToken | String | Token of the batch that created this command; null for a command issued one at a time. |
createdAt | String | When the record was created, as an RFC 3339 timestamp. |
deletedAt | String | When the record was deleted, as an RFC 3339 timestamp. Deleted records are not returned by this API, so this is null in practice. |
deliveredTime | String | When the platform first had evidence that the device had the command, as an RFC 3339 timestamp; null when it has none. This is evidence beside the status, not a status: a command can be SUCCESSFUL with no delivery time (a channel with no acknowledgement and no answer to count) and a command that failed as NOT_DELIVERED never has one. |
deliveryAttempts | Int | How many times the HTTP pull channel has handed this command out; null for a command it never handed out. |
deliveryEvidence | String | What the delivery time rests on: DEVICE_ACK (the device acknowledged receipt on the HTTP pull channel) or DEVICE_RESPONSE (the device answered the command, on any channel). Null when deliveredTime is. The first piece of evidence is kept. |
deliveryMode | String | ONEWAY for a command the device acknowledges and does not answer (the acknowledgement settles it as SUCCESSFUL), null for an ordinary two-way command. |
deviceToken | String! | Token of the device the command is addressed to. |
dispatchAfter | String | The start of the maintenance-window opening the command may be sent in, as an RFC 3339 timestamp; null when the command is not gated by a window. While the status is QUEUED, HELD or PARKED and this is in the future the command is waiting for the window; it stays QUEUED while it waits. A past value means the opening has begun. A command that is not sent before that opening closes is moved to the next one. The window may since have been deleted while the command waits for its device type to be resolved. |
error | String | Why the command failed. Set when status is FAILED and a reason exists: the message the device reported, or the platform's own explanation when it gave up publishing, lost the answer, or failed a command waiting for a maintenance window because the device's profile no longer defines it. Null otherwise. |
expiresAt | String | Instant after which an undelivered command expires, as an RFC 3339 timestamp. When none was given at creation the platform stamps its default time-to-live (7 days unless the deployment configures another). Null means the command does not expire. |
id | ID! | Server-assigned numeric identifier, serialized as a string. Look entities up by token where one exists. |
maintenanceWindowToken | String | The token of the maintenance window that gates the command, or null when it is not gated. Editing that window moves the commands still waiting on it to the new schedule. The token may name a deleted window while the command waits for its device type to be resolved. |
maxAttempts | Int | The most times the HTTP pull channel hands this command out before giving up on its acknowledgement; null for the platform default of 3. |
metadata | String | Free-form metadata supplied when the command was created, as a JSON document serialized to a string; null when none was supplied. |
name | String! | The command's name, as defined in the command vocabulary of the device's profile. |
outcome | String | What a finished command physically amounted to, recorded by the write that finished it; null while the command is still live. SUCCEEDED: the device reported success. NOT_DELIVERED: proven never to have reached the device (expired or cancelled while the platform held it, or the platform gave up publishing it, or failed it while it waited for a maintenance window because the device's profile no longer defines it), so sending it again cannot act twice. REJECTED: the device received it and answered that it did not do it. UNKNOWN: it may have reached the device and acted (sent and never answered, or answered and the answer lost), so sending it again may act twice. Commands that finished before this field existed are UNKNOWN unless their status alone decides it. Branch on this, not on error text. |
payload | String | The command's arguments, as a JSON document serialized to a string; null when none was supplied. |
queuedTime | String | When the command was accepted, as an RFC 3339 timestamp. |
respondedTime | String | When the device's answer was recorded, as an RFC 3339 timestamp; null until a device answers. |
responsePayload | String | The payload the device returned with its answer, as a JSON document serialized to a string; null until the device answers or when it returned none. |
sentTime | String | When the command was last dispatched toward the device, as an RFC 3339 timestamp. Null if it has not been dispatched, or if the dispatch was handed back (the command returned to QUEUED or PARKED). |
status | String! | Lifecycle state: one of QUEUED, HELD, SENT, PARKED, SUCCESSFUL, FAILED, TIMEOUT, EXPIRED or CANCELLED. QUEUED: accepted and awaiting its first dispatch decision. HELD: withheld because the device is known to be absent; it returns to QUEUED when the device comes back. SENT: dispatched toward the device and awaiting its response. PARKED: dispatched, but the transport found the device unreachable so nothing reached it; it is delivered on the device's next wake. SUCCESSFUL and FAILED: the device answered, reporting success or failure (FAILED is also set when the platform gives up publishing the command, or loses the device's answer; see error). TIMEOUT: the command expired while SENT without an answer. EXPIRED: the command expired while QUEUED, HELD or PARKED, so it never reached the device. CANCELLED: called off by a caller or by cancelling its batch. SUCCESSFUL, FAILED, TIMEOUT, EXPIRED and CANCELLED are terminal: no further transition occurs. |
token | String! | Tenant-unique token. For a command created with createCommand it is the idempotency key the caller chose; for a command created by a batch it is chosen by the platform. |
updatedAt | String | When the record was last modified, as an RFC 3339 timestamp. |
CommandBatch
object
One command fanned out to many devices, kept as a record. A device the batch refused gets no command row, so this record is the only trace of what was attempted and what was refused.
Implements Model, TokenReference, MetadataEntity
| Field | Type | Description |
|---|---|---|
accepted | Int! | How many devices a command was enqueued for when the batch fired. A stored fact about that moment, not a live count; to see what those commands are doing now, search commands by batchToken. resolved equals accepted plus the sum of refusalCounts. |
allowPartial | Boolean! | Whether the caller accepted a partial fan-out, in which devices that could not be enqueued were skipped rather than failing the whole batch. |
cancelledAt | String | When the batch was first cancelled, as an RFC 3339 timestamp; null until it is cancelled. Cancelling again does not change it. |
cancelledCount | Int | How many commands the first cancel call stopped; null until the batch is cancelled. A snapshot from that call, not a live count of CANCELLED commands. |
createdAt | String | When the record was created, as an RFC 3339 timestamp. |
deletedAt | String | When the record was deleted, as an RFC 3339 timestamp. Deleted records are not returned by this API, so this is null in practice. |
groupToken | String | Token of the entity group the batch was fired at; null for a device-list batch. |
groupVersion | Int | The frozen version of the group that the target set was resolved against. Null for a device-list batch and for a static group, which is not versioned. |
id | ID! | Server-assigned numeric identifier, serialized as a string. Look entities up by token where one exists. |
metadata | String | Free-form metadata supplied when the batch was created, as a JSON document serialized to a string; null when none was supplied. |
name | String! | The command name every device in the batch received. |
payload | String | The payload every device in the batch received, as a JSON document serialized to a string; null when none was supplied. |
refusalCounts | [CommandBatchRefusalCount!]! | The exact number of refused devices per refusal code. |
refusals | [CommandBatchDeviceRefusal!]! | A bounded sample of the devices that were refused (at most 100 per refusal code). Use refusalCounts for exact totals. |
resolved | Int! | How many devices the target resolved to when the batch fired. A stored fact about that moment, not a live count. |
retries | [String!]! | Tokens of the batches that retried this one, oldest first, at most 100. Empty when none did. |
retryOf | String | Token of the batch this one retries, when it was created by retryCommandBatch; null for an ordinary batch. A retry of a retry names the retry, not the first batch. |
targetKind | String! | How the target was specified: DEVICE_LIST (devices named explicitly) or GROUP (an entity group resolved when the batch fired). |
token | String! | Tenant-unique token; the idempotency key supplied when the batch was created. |
updatedAt | String | When the record was last modified, as an RFC 3339 timestamp. |
waiting | Int | How many of the accepted commands were held for their device type's maintenance window when the batch fired. A stored fact about that moment, not a live count; null for a batch from before maintenance windows existed. To see which have gone out since, search commands by batchToken. |
CommandBatchDeviceRefusal
object
One device a batch did not enqueue to, and why.
| Field | Type | Description |
|---|---|---|
code | String! | Machine-readable classification, from the same open vocabulary as CommandEnqueueRejection.code (for example DEVICE_NOT_FOUND, DEVICE_DISABLED, COMMAND_NOT_IN_VOCABULARY, PAYLOAD_SCHEMA_VIOLATION or HELD_CEILING_EXCEEDED). Branch on this, not on reason. |
deviceToken | String! | Token of the refused device, as it was named or resolved. |
reason | String! | Human-readable explanation, safe to show to a user. Do not parse it. |
CommandBatchRefusalCount
object
The exact number of devices refused for one code. Unlike the refusals sample, a count is never truncated.
| Field | Type | Description |
|---|---|---|
code | String! | The refusal code being counted. |
count | Int! | How many devices were refused with that code. |
CommandBatchRejection
object
Why a batch was refused. A refusal is a decided answer about the request, not a failure of the platform.
| Field | Type | Description |
|---|---|---|
code | String! | Stable, machine-readable classification: BATCH_TARGET_AMBIGUOUS, BATCH_TOO_LARGE, BATCH_GROUP_UNUSABLE (the group does not exist, collects something other than devices, was never published, or the named version does not exist or was named for a static group), PAYLOAD_NOT_JSON, METADATA_NOT_JSON, COMMAND_NAME_TOO_LONG, PAYLOAD_TOO_LARGE, METADATA_TOO_LARGE, EXPIRES_AT_INVALID, BATCH_PARTIAL_REFUSED or HELD_CEILING_EXCEEDED. Branch on this, never on reason. The list is open: treat an unrecognized code as a refusal you cannot classify. HELD_CEILING_EXCEEDED is temporary; the others will be refused again if re-sent unchanged. There is no TOKEN_IN_USE here: re-sending a batch token returns the original batch. |
reason | String! | Human-readable explanation, safe to show to a user. Do not parse it. |
refusalCounts | [CommandBatchRefusalCount!]! | The exact per-code totals behind the refusals sample. |
refusals | [CommandBatchDeviceRefusal!]! | A bounded sample (at most 100) of the devices responsible. Populated only for BATCH_PARTIAL_REFUSED and empty for every other code. |
resolved | Int | How many devices the target resolved to before the refusal. Null means no target set was established (the refusal came first); zero means the target genuinely resolved to no devices. |
CommandBatchSearchResults
object
One page of command batches.
| Field | Type | Description |
|---|---|---|
pagination | SearchResultsPagination! | Where this page sits within all matching batches. |
results | [CommandBatch!]! | The batches on this page, newest first. |
CommandEnqueueRejection
object
Why an enqueue was refused. A refusal is a decided answer about the request, not a failure of the platform.
| Field | Type | Description |
|---|---|---|
code | String! | Stable, machine-readable classification: PAYLOAD_NOT_JSON, METADATA_NOT_JSON, COMMAND_NAME_TOO_LONG, PAYLOAD_TOO_LARGE, METADATA_TOO_LARGE, EXPIRES_AT_INVALID, HELD_CEILING_EXCEEDED, TOKEN_IN_USE, DEVICE_NOT_FOUND, DEVICE_DISABLED, COMMAND_NOT_IN_VOCABULARY, PAYLOAD_SCHEMA_VIOLATION, DELIVERY_OPTION_INVALID, DELIVERY_OPTION_NOT_APPLICABLE, or COMMAND_REJECTED when a refusal arrived without a classification. Branch on this, never on reason. The list is open: treat an unrecognized code as a refusal you cannot classify, never as success. HELD_CEILING_EXCEEDED is the only temporary one (the tenant is holding its limit of commands for absent devices and the limit frees as they return); the rest will be refused again if re-sent unchanged. TOKEN_IN_USE means the token belongs to a command you do not own, which in practice is one the platform created for a batch; choose another token. |
reason | String! | Human-readable explanation, safe to show to a user. Its wording may change; do not parse it. |
CommandSearchResults
object
One page of commands.
| Field | Type | Description |
|---|---|---|
pagination | SearchResultsPagination! | Where this page sits within all matching commands. |
results | [Command!]! | The commands on this page, newest first. |
CreateCampaignResult
object
The outcome of createCampaign. Exactly one of campaign and rejection is non-null.
| Field | Type | Description |
|---|---|---|
campaign | Campaign | The created campaign. |
rejection | CommandBatchRejection | Why the campaign was refused: CAMPAIGN_TRIGGER_INVALID, CAMPAIGN_STEPS_INVALID, CAMPAIGN_STEP_UNSUPPORTED, CAMPAIGN_TARGET_INVALID, CAMPAIGN_FIELD_INVALID, PAYLOAD_NOT_JSON, PAYLOAD_TOO_LARGE, COMMAND_NAME_TOO_LONG or TOKEN_IN_USE. |
CreateCommandBatchResult
object
The outcome of createCommandBatch. Exactly one of batch and rejection is non-null.
| Field | Type | Description |
|---|---|---|
batch | CommandBatch | The batch that was created, or the original batch when the token was already in use. Null when the request was refused. |
rejection | CommandBatchRejection | Why the batch was refused. Null when a batch was created. |
CreateCommandResult
object
The outcome of createCommand. Exactly one of command and rejection is non-null.
| Field | Type | Description |
|---|---|---|
command | Command | The command that was created, or the original command when the token was already in use by one of your own commands. Null when the request was refused. |
rejection | CommandEnqueueRejection | Why the request was refused. Null when a command was created. |
DeviceCommandHold
object
What the platform is holding for one device because it is disabled.
| Field | Type | Description |
|---|---|---|
disabled | Boolean! | True while the platform has the device recorded as disabled. |
heldCount | Int! | How many commands are held on the device's account: every command it still has that has not been sent (queued, held or parked). Zero for an enabled device, whatever its backlog, because nothing is held on its account then. This is exactly the set cancelDeviceCommands cancels. |
PulledCommand
object
A command the HTTP pull channel handed to a device.
| Field | Type | Description |
|---|---|---|
attempt | Int! | How many times this command has now been handed out, counting this one. |
deliveryMode | String | ONEWAY if the device only acknowledges the command; null if it must also answer. |
expiresAt | String | When the command expires, as an RFC 3339 timestamp; null if it does not. |
name | String! | The command's name, as defined in the command vocabulary of the device's profile. |
payload | String | The command's arguments as a JSON document serialized to a string; null when none. |
token | String! | Token of the command; the device quotes it when it acknowledges and when it answers. |
SearchResultsPagination
object
Where one page of search results sits within the full result set. Positions are 1-based and inclusive.
| Field | Type | Description |
|---|---|---|
pageEnd | Int | Position of the last result of this page within the full result set (1-based, inclusive). Capped at totalRecords. |
pageStart | Int | Position of the first result of this page within the full result set (1-based). |
totalRecords | Int | Number of records matching the criteria across all pages. |
Interfaces
MetadataEntity · Model · TokenReference
MetadataEntity
interface
An entity that carries free-form metadata.
| Field | Type | Description |
|---|---|---|
metadata | String | Free-form metadata as a JSON document serialized to a string; null when none was supplied. |
Model
interface
Fields common to every stored record.
| Field | Type | Description |
|---|---|---|
createdAt | String | When the record was created, as an RFC 3339 timestamp. |
deletedAt | String | When the record was deleted, as an RFC 3339 timestamp. Deleted records are not returned by this API, so this is null in practice. |
id | ID! | Server-assigned numeric identifier, serialized as a string. Look entities up by token where one exists. |
updatedAt | String | When the record was last modified, as an RFC 3339 timestamp. |
TokenReference
interface
An entity addressed by a tenant-unique token.
| Field | Type | Description |
|---|---|---|
token | String! | Tenant-unique token that identifies the entity. |
Input types
CampaignCreateRequest · CampaignStepInput · CommandBatchCreateRequest · CommandBatchRetryRequest · CommandBatchSearchCriteria · CommandCreateRequest · CommandSearchCriteria
CampaignCreateRequest
input
Fields for creating a campaign.
| Input field | Type | Description |
|---|---|---|
enabled | Boolean | Whether the campaign starts switched on. Optional; default true. |
expiresInSeconds | Int | Time-to-live of each command, 1 to 604800. Optional; default 3600. |
groupToken | String! | Token of the entity group to target, at most 128 characters. |
maxLatenessSeconds | Int | How late a planned command may still be sent, 1 to 86400. Optional; default 900. |
name | String | Human-readable name, at most 128 characters. Optional. |
steps | [CampaignStepInput!]! | The steps, one to ten. |
targetKind | String | GROUP, or omitted. |
token | String! | Identifier for the campaign, unique within the tenant. |
trigger | String! | The trigger, as a JSON document. kind CRON: {"kind":"CRON","zone":"Europe/Berlin","cron":"30 18 * * *"}. kind CALENDAR: dates (YYYY-MM-DD) and times (HH:MM) in the zone. kind SOLAR: event SUNRISE or SUNSET and offsetMinutes, computed per device from its installed position (Device.installedPosition). Every kind requires an IANA zone and may carry holidays (YYYY-MM-DD local dates on which it does not fire). |
CampaignStepInput
input
One step of a new campaign.
| Input field | Type | Description |
|---|---|---|
delaySeconds | Int | Seconds after the trigger at which the step fires, 0 to 86400. Optional; default 0. |
name | String | The command name. Required for a COMMAND step. |
payload | String | The command payload as a JSON document. Optional. |
type | String! | COMMAND. ARTIFACT is recognised and refused with CAMPAIGN_STEP_UNSUPPORTED. |
CommandBatchCreateRequest
input
Fields for issuing one command to many devices. Supply exactly one of deviceTokens and groupToken; both or neither is refused with BATCH_TARGET_AMBIGUOUS.
| Input field | Type | Description |
|---|---|---|
allowPartial | Boolean! | Required. When true, devices that cannot receive the command are skipped and recorded as refusals. When false, a batch in which any device cannot receive the command is refused whole (BATCH_PARTIAL_REFUSED) and nothing is created. |
deviceTokens | [String!] | Tokens of the devices to command, at most 10000. The order is the order devices are admitted in when the batch is partially admitted. An empty list counts as not supplied. |
expiresAt | String | RFC 3339 timestamp after which the batch's undelivered commands expire. Optional; when omitted the platform's default time-to-live applies. |
groupToken | String | Token of an entity group of devices, resolved to its members when the batch fires. A dynamic group must have been published. A group that resolves to more than 10000 devices is refused with BATCH_TOO_LARGE. Requires device:read in addition to command:write. |
groupVersion | Int | A specific frozen version of a dynamic group to resolve against. Omit for the group's active published version. Naming a version without a group, or for a static group, is refused. |
metadata | String | Free-form metadata as a JSON document serialized to a string. Must be valid JSON. At most 65536 bytes (METADATA_TOO_LARGE). Optional. |
name | String! | Name of the command every targeted device receives, as defined in each device's command vocabulary. At most 128 bytes, or the request is refused with COMMAND_NAME_TOO_LONG. |
payload | String | The payload every device receives, as a JSON document serialized to a string. Must be valid JSON. At most 65536 bytes (PAYLOAD_TOO_LARGE). Optional. |
token | String! | Idempotency key for the whole batch, unique within the tenant. Re-sending a token that already names a batch returns that batch unchanged and admits no further devices. |
CommandBatchRetryRequest
input
Fields for re-issuing a batch's command to a chosen subset of its devices. The command name and payload are copied from the original batch; they cannot be changed here.
| Input field | Type | Description |
|---|---|---|
allowPartial | Boolean! | Required. As for createCommandBatch: when true, devices that cannot receive the command now are skipped and recorded as refusals; when false, any such device refuses the whole retry. |
deviceTokens | [String!]! | Tokens of the devices to retry, at most 10000. Each must be a member of the original batch and unsuccessful (see includeUnknown). The order is the order devices are admitted in when the retry is partially admitted. |
expiresAt | String | RFC 3339 timestamp after which the retry's undelivered commands expire. Optional; when omitted the platform's default time-to-live applies. |
includeUnknown | Boolean! | Whether to also retry devices whose outcome is UNKNOWN: commands that may already have reached the device and acted. Devices with that outcome are refused with RETRY_UNKNOWN_NOT_ACKNOWLEDGED unless this is true. Only set it after confirming that acting twice is harmless. |
metadata | String | Free-form metadata for the retry batch, as a JSON document serialized to a string. Optional. |
of | String! | Token of the batch to retry. It may itself be a retry. |
token | String! | Idempotency key for the retry, unique within the tenant and different from the original batch's. Re-sending it returns the retry unchanged and admits nothing further. Re-sending the ORIGINAL batch's token through createCommandBatch still returns the original and executes nothing. |
CommandBatchSearchCriteria
input
Filters and paging for searching command batches. All supplied filters must match. Results are newest first.
| Input field | Type | Description |
|---|---|---|
groupToken | String | Only batches fired at this entity group. Device-list batches never match. |
name | String | Only batches that fanned out this command name. |
pageNumber | Int! | Page to return, starting at 1; values below 1 are treated as 1. |
pageSize | Int! | Results per page. Values below 1 become 100; values above 1000 are capped at 1000. |
targetKind | String | Only batches of this kind: DEVICE_LIST or GROUP. An unrecognized value matches nothing rather than raising an error. |
CommandCreateRequest
input
Fields for issuing a command to one device.
| Input field | Type | Description |
|---|---|---|
deliveryMode | String | ONEWAY for a command the device acknowledges and does not answer. Accepted only for a device whose type has the HTTP_PULL command channel; otherwise the request is refused with DELIVERY_OPTION_NOT_APPLICABLE (or DELIVERY_OPTION_INVALID for any other value). Optional. |
deviceToken | String! | Token of the device to command. |
expiresAt | String | RFC 3339 timestamp after which the command expires if undelivered. Optional; when omitted the platform's default time-to-live applies. |
maxAttempts | Int | The most times the HTTP pull channel hands the command out before giving up on its acknowledgement, 1 to 10. Accepted only for a device on the HTTP_PULL channel, like deliveryMode. Optional; the platform default is 3. |
metadata | String | Free-form metadata as a JSON document serialized to a string. Must be valid JSON. At most 65536 bytes (METADATA_TOO_LARGE). Optional. |
name | String! | Name of the command, which must exist in the command vocabulary of the device's profile; otherwise the request is refused with COMMAND_NOT_IN_VOCABULARY. At most 128 bytes, or the request is refused with COMMAND_NAME_TOO_LONG. |
payload | String | The command's arguments as a JSON document serialized to a string. Must be valid JSON and, when the command definition declares a schema, conform to it. At most 65536 bytes (PAYLOAD_TOO_LARGE). Optional. |
token | String! | Idempotency key for the command, unique within the tenant. Re-sending a token you already used returns the original command instead of creating a second one. |
CommandSearchCriteria
input
Filters and paging for searching commands. All supplied filters must match. Results are newest first.
| Input field | Type | Description |
|---|---|---|
batchToken | String | Only commands created by this batch. This is how to ask what a fleet write is doing now, since the batch record keeps only counts from the moment it fired. Combine with status or statuses. Rows come back in the order the batch admitted its devices. |
deviceToken | String | Only commands addressed to this device. |
endTime | String | Only commands sent at or before this instant (inclusive), or queued at or before it when never sent, as an RFC 3339 timestamp. Omit for no upper bound. A value that is not RFC 3339 is an error. |
outcomes | [String!] | Only finished commands whose outcome is one of these (SUCCEEDED, NOT_DELIVERED, REJECTED or UNKNOWN). Live commands have no outcome and never match. An empty list is ignored. |
pageNumber | Int! | Page to return, starting at 1; values below 1 are treated as 1. |
pageSize | Int! | Results per page. Values below 1 become 100; values above 1000 are capped at 1000. |
startTime | String | Only commands sent at or after this instant (inclusive), as an RFC 3339 timestamp. A command never sent (queued, held, or expired or cancelled first) is placed at the time it was queued instead. Omit for no lower bound. A value that is not RFC 3339 is an error. |
status | String | Only commands in exactly this lifecycle state (for example HELD). |
statuses | [String!] | Only commands in any of these lifecycle states. Combined with status, a command must satisfy both. An empty list is ignored rather than matching nothing. |