Saltar al contenido principal

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.

Endpointhttps://<your-host>/api/command-delivery/graphql
Plano de autenticacióntenant — 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óntenant access token
Archivo del esquema/schema/command-delivery.graphql
Descritos295 de 295 elementos
nota

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

ArgumentTypeDescription
tokenString!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!]!

ArgumentTypeDescription
campaignTokenString!Token of the campaign.
limitIntMaximum 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!]!

ArgumentTypeDescription
afterIdIDReturn elements after this id. Optional.
campaignTokenString!Token of the campaign.
cycleKeyString!Key of the cycle.
limitIntMaximum elements to return, 1 to 1000. Absent or out of range means 200.
statusStringOnly 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!]!

ArgumentTypeDescription
limitIntMaximum 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!

ArgumentTypeDescription
criteriaCommandBatchSearchCriteria!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!]!

ArgumentTypeDescription
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!]!

ArgumentTypeDescription
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!

ArgumentTypeDescription
criteriaCommandSearchCriteria!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!]!

ArgumentTypeDescription
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!]!

ArgumentTypeDescription
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!

ArgumentTypeDescription
deviceTokenString!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!]!

ArgumentTypeDescription
deviceTokenString!Token of the device whose backlog to read.
limitIntMaximum 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!

ArgumentTypeDescription
deviceTokenString!Token of the device that acknowledged.
tokenString!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!

ArgumentTypeDescription
tokenString!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!

ArgumentTypeDescription
tokenString!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!

ArgumentTypeDescription
deviceTokenString!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

ArgumentTypeDescription
dispatchNonceString!The dispatch nonce carried in the delivery.
tokenString!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!

ArgumentTypeDescription
requestCampaignCreateRequest!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!

ArgumentTypeDescription
requestCommandCreateRequest!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!

ArgumentTypeDescription
requestCommandBatchCreateRequest!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!

ArgumentTypeDescription
tokenString!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

ArgumentTypeDescription
tokenString!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!

ArgumentTypeDescription
dispatchNonceString!The dispatch nonce carried in the delivery this command arrived in.
tokenString!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!]!

ArgumentTypeDescription
deviceTokenString!Token of the device pulling.
limitIntAt 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!

ArgumentTypeDescription
deviceTokenString!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!

ArgumentTypeDescription
deviceTokenString!Token of the device that answered.
errorStringWhy the device did not carry the command out. Optional.
payloadStringThe device's answer payload as text. At most 65536 bytes. Optional.
successBoolean!True if the device carried the command out.
tokenString!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!

ArgumentTypeDescription
campaignTokenString!Token of the campaign.
cycleKeyString!Key of the cycle.
includeUnknownBoolean!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!

ArgumentTypeDescription
requestCommandBatchRetryRequest!The retry to issue.

setCampaignEnabled​

Switches a campaign on or off and returns it. Requires command:write and device:read.

Returns Campaign!

ArgumentTypeDescription
enabledBoolean!Whether the campaign should run.
tokenString!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.

FieldTypeDescription
createdAtStringWhen the campaign was created, as an RFC 3339 timestamp.
enabledBoolean!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.
expiresInSecondsInt!Time-to-live, in seconds, of each command the campaign creates.
groupTokenString!Token of the entity group whose devices the campaign targets.
idID!Server-assigned numeric identifier, as a string.
lastErrorStringWhy the last planning attempt failed; null when it succeeded.
maxLatenessSecondsInt!How late, in seconds, a planned command may still be sent. Later ones are skipped as MISSED.
nameStringHuman-readable name; null when none is set.
plannedThroughStringThe instant up to which cycles have been planned; null before the first plan.
steps[CampaignStep!]!The command steps, in order.
targetKindString!Kind of target. Always GROUP in this release.
tokenString!Identifier of the campaign, unique within the tenant.
triggerString!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.
updatedAtStringWhen the campaign was last written, as an RFC 3339 timestamp.

CampaignCycle​

object

One firing of a campaign.

FieldTypeDescription
atStringThe fire instant of a CRON or CALENDAR cycle; null for SOLAR, whose instant is per device.
countsCampaignCycleCounts!Where the cycle's elements and their commands stand now.
createdAtStringWhen the cycle was planned, as an RFC 3339 timestamp.
dayStringThe local civil date (YYYY-MM-DD) of a SOLAR cycle; null otherwise.
keyString!Stable key of the firing; pass it as cycleKey.
resolvedInt!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.

FieldTypeDescription
claimedInt!Due and being sent.
dispatchedInt!Sent: a command was created.
failedInt!Commands that finished without success and are safe to send again.
inFlightInt!Commands not yet finished.
pendingInt!Planned and not yet due.
refusedInt!Not admitted by the command batch (vocabulary, ceiling, maintenance window...).
skippedInt!Never commanded: NO_SITE, POLAR_DAY, POLAR_NIGHT, MISSED, CANCELLED, PREDATES_CAMPAIGN, DISABLED, SUPERSEDED or NOT_IN_GROUP.
succeededInt!Commands that succeeded.
unknownInt!Commands that finished with an outcome that cannot be vouched for; a retry needs includeUnknown.
waitingInt!Of the in-flight commands, how many are held for a maintenance window.

CampaignElement​

object

One device's step in one cycle.

FieldTypeDescription
batchTokenStringToken of the batch that carried the command; null before it is sent.
commandOutcomeStringOutcome class of that command once finished: SUCCEEDED, NOT_DELIVERED, REJECTED or UNKNOWN.
commandStatusStringStatus of the latest command for the element; null when it has none.
deviceTokenString!Token of the device.
dueAtString!When the element falls due, as an RFC 3339 timestamp.
idID!Server-assigned numeric identifier; pass the last one on a page as afterId.
reasonStringWhy 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).
retryBatchTokenStringToken of the batch a retry re-sent it in; null when it was not retried.
statusString!PENDING, CLAIMED, DISPATCHED, REFUSED or SKIPPED.
stepInt!Zero-based index of the step.

CampaignRetryResult​

object

What a retry-from-failed did.

FieldTypeDescription
batches[String!]!Tokens of the retry batches created or replayed.
heldInt!How many were left alone because re-sending is unsafe: still in flight, or unknown without includeUnknown.
retriedInt!How many elements were re-sent.

CampaignStep​

object

One step of a campaign.

FieldTypeDescription
delaySecondsInt!Seconds after the trigger at which the step fires, per device.
nameStringThe command name.
payloadStringThe command payload as a JSON document; null when none.
typeString!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.

FieldTypeDescription
alreadyFinishedInt!Commands that had already succeeded, failed, timed out, expired or been cancelled before this call. Nothing to do.
alreadySentInt!Commands already handed to their devices. They cannot be recalled and the devices will still act on them.
cancelledInt!Commands the platform still held and has now stopped. They will not be delivered.
matchedInt!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.

FieldTypeDescription
cancelledInt!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

FieldTypeDescription
batchTokenStringToken of the batch that created this command; null for a command issued one at a time.
createdAtStringWhen the record was created, as an RFC 3339 timestamp.
deletedAtStringWhen the record was deleted, as an RFC 3339 timestamp. Deleted records are not returned by this API, so this is null in practice.
deliveredTimeStringWhen 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.
deliveryAttemptsIntHow many times the HTTP pull channel has handed this command out; null for a command it never handed out.
deliveryEvidenceStringWhat 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.
deliveryModeStringONEWAY for a command the device acknowledges and does not answer (the acknowledgement settles it as SUCCESSFUL), null for an ordinary two-way command.
deviceTokenString!Token of the device the command is addressed to.
dispatchAfterStringThe 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.
errorStringWhy 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.
expiresAtStringInstant 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.
idID!Server-assigned numeric identifier, serialized as a string. Look entities up by token where one exists.
maintenanceWindowTokenStringThe 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.
maxAttemptsIntThe most times the HTTP pull channel hands this command out before giving up on its acknowledgement; null for the platform default of 3.
metadataStringFree-form metadata supplied when the command was created, as a JSON document serialized to a string; null when none was supplied.
nameString!The command's name, as defined in the command vocabulary of the device's profile.
outcomeStringWhat 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.
payloadStringThe command's arguments, as a JSON document serialized to a string; null when none was supplied.
queuedTimeStringWhen the command was accepted, as an RFC 3339 timestamp.
respondedTimeStringWhen the device's answer was recorded, as an RFC 3339 timestamp; null until a device answers.
responsePayloadStringThe 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.
sentTimeStringWhen 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).
statusString!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.
tokenString!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.
updatedAtStringWhen 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

FieldTypeDescription
acceptedInt!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.
allowPartialBoolean!Whether the caller accepted a partial fan-out, in which devices that could not be enqueued were skipped rather than failing the whole batch.
cancelledAtStringWhen the batch was first cancelled, as an RFC 3339 timestamp; null until it is cancelled. Cancelling again does not change it.
cancelledCountIntHow 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.
createdAtStringWhen the record was created, as an RFC 3339 timestamp.
deletedAtStringWhen the record was deleted, as an RFC 3339 timestamp. Deleted records are not returned by this API, so this is null in practice.
groupTokenStringToken of the entity group the batch was fired at; null for a device-list batch.
groupVersionIntThe 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.
idID!Server-assigned numeric identifier, serialized as a string. Look entities up by token where one exists.
metadataStringFree-form metadata supplied when the batch was created, as a JSON document serialized to a string; null when none was supplied.
nameString!The command name every device in the batch received.
payloadStringThe 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.
resolvedInt!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.
retryOfStringToken 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.
targetKindString!How the target was specified: DEVICE_LIST (devices named explicitly) or GROUP (an entity group resolved when the batch fired).
tokenString!Tenant-unique token; the idempotency key supplied when the batch was created.
updatedAtStringWhen the record was last modified, as an RFC 3339 timestamp.
waitingIntHow 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.

FieldTypeDescription
codeString!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.
deviceTokenString!Token of the refused device, as it was named or resolved.
reasonString!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.

FieldTypeDescription
codeString!The refusal code being counted.
countInt!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.

FieldTypeDescription
codeString!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.
reasonString!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.
resolvedIntHow 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.

FieldTypeDescription
paginationSearchResultsPagination!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.

FieldTypeDescription
codeString!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.
reasonString!Human-readable explanation, safe to show to a user. Its wording may change; do not parse it.

CommandSearchResults​

object

One page of commands.

FieldTypeDescription
paginationSearchResultsPagination!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.

FieldTypeDescription
campaignCampaignThe created campaign.
rejectionCommandBatchRejectionWhy 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.

FieldTypeDescription
batchCommandBatchThe batch that was created, or the original batch when the token was already in use. Null when the request was refused.
rejectionCommandBatchRejectionWhy 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.

FieldTypeDescription
commandCommandThe 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.
rejectionCommandEnqueueRejectionWhy the request was refused. Null when a command was created.

DeviceCommandHold​

object

What the platform is holding for one device because it is disabled.

FieldTypeDescription
disabledBoolean!True while the platform has the device recorded as disabled.
heldCountInt!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.

FieldTypeDescription
attemptInt!How many times this command has now been handed out, counting this one.
deliveryModeStringONEWAY if the device only acknowledges the command; null if it must also answer.
expiresAtStringWhen the command expires, as an RFC 3339 timestamp; null if it does not.
nameString!The command's name, as defined in the command vocabulary of the device's profile.
payloadStringThe command's arguments as a JSON document serialized to a string; null when none.
tokenString!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.

FieldTypeDescription
pageEndIntPosition of the last result of this page within the full result set (1-based, inclusive). Capped at totalRecords.
pageStartIntPosition of the first result of this page within the full result set (1-based).
totalRecordsIntNumber of records matching the criteria across all pages.

Interfaces​

MetadataEntity · Model · TokenReference

MetadataEntity​

interface

An entity that carries free-form metadata.

FieldTypeDescription
metadataStringFree-form metadata as a JSON document serialized to a string; null when none was supplied.

Model​

interface

Fields common to every stored record.

FieldTypeDescription
createdAtStringWhen the record was created, as an RFC 3339 timestamp.
deletedAtStringWhen the record was deleted, as an RFC 3339 timestamp. Deleted records are not returned by this API, so this is null in practice.
idID!Server-assigned numeric identifier, serialized as a string. Look entities up by token where one exists.
updatedAtStringWhen the record was last modified, as an RFC 3339 timestamp.

TokenReference​

interface

An entity addressed by a tenant-unique token.

FieldTypeDescription
tokenString!Tenant-unique token that identifies the entity.

Input types​

CampaignCreateRequest · CampaignStepInput · CommandBatchCreateRequest · CommandBatchRetryRequest · CommandBatchSearchCriteria · CommandCreateRequest · CommandSearchCriteria

CampaignCreateRequest​

input

Fields for creating a campaign.

Input fieldTypeDescription
enabledBooleanWhether the campaign starts switched on. Optional; default true.
expiresInSecondsIntTime-to-live of each command, 1 to 604800. Optional; default 3600.
groupTokenString!Token of the entity group to target, at most 128 characters.
maxLatenessSecondsIntHow late a planned command may still be sent, 1 to 86400. Optional; default 900.
nameStringHuman-readable name, at most 128 characters. Optional.
steps[CampaignStepInput!]!The steps, one to ten.
targetKindStringGROUP, or omitted.
tokenString!Identifier for the campaign, unique within the tenant.
triggerString!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 fieldTypeDescription
delaySecondsIntSeconds after the trigger at which the step fires, 0 to 86400. Optional; default 0.
nameStringThe command name. Required for a COMMAND step.
payloadStringThe command payload as a JSON document. Optional.
typeString!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 fieldTypeDescription
allowPartialBoolean!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.
expiresAtStringRFC 3339 timestamp after which the batch's undelivered commands expire. Optional; when omitted the platform's default time-to-live applies.
groupTokenStringToken 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.
groupVersionIntA 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.
metadataStringFree-form metadata as a JSON document serialized to a string. Must be valid JSON. At most 65536 bytes (METADATA_TOO_LARGE). Optional.
nameString!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.
payloadStringThe payload every device receives, as a JSON document serialized to a string. Must be valid JSON. At most 65536 bytes (PAYLOAD_TOO_LARGE). Optional.
tokenString!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 fieldTypeDescription
allowPartialBoolean!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.
expiresAtStringRFC 3339 timestamp after which the retry's undelivered commands expire. Optional; when omitted the platform's default time-to-live applies.
includeUnknownBoolean!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.
metadataStringFree-form metadata for the retry batch, as a JSON document serialized to a string. Optional.
ofString!Token of the batch to retry. It may itself be a retry.
tokenString!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 fieldTypeDescription
groupTokenStringOnly batches fired at this entity group. Device-list batches never match.
nameStringOnly batches that fanned out this command name.
pageNumberInt!Page to return, starting at 1; values below 1 are treated as 1.
pageSizeInt!Results per page. Values below 1 become 100; values above 1000 are capped at 1000.
targetKindStringOnly 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 fieldTypeDescription
deliveryModeStringONEWAY 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.
deviceTokenString!Token of the device to command.
expiresAtStringRFC 3339 timestamp after which the command expires if undelivered. Optional; when omitted the platform's default time-to-live applies.
maxAttemptsIntThe 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.
metadataStringFree-form metadata as a JSON document serialized to a string. Must be valid JSON. At most 65536 bytes (METADATA_TOO_LARGE). Optional.
nameString!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.
payloadStringThe 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.
tokenString!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 fieldTypeDescription
batchTokenStringOnly 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.
deviceTokenStringOnly commands addressed to this device.
endTimeStringOnly 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.
pageNumberInt!Page to return, starting at 1; values below 1 are treated as 1.
pageSizeInt!Results per page. Values below 1 become 100; values above 1000 are capped at 1000.
startTimeStringOnly 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.
statusStringOnly 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.