openapi: 3.0.3 info: description: Provides a set of endpoints to manage Devices, Things, Properties and Timeseries title: Arduino IoT Cloud binaries_v2 usage_internal API version: '2.0' tags: - name: usage_internal paths: /iot/v1/usage/batch: post: description: 'Upserts a batch of per-(owner, thing, device, date) message counters. The payload carries two flat lists, users_usage and orgs_usage, that can be populated independently in the same request. Rows in users_usage must be unique by (user_id, thing_id, device_id, date). Rows in orgs_usage must be unique by (org_id, thing_id, device_id, date). Duplicate rows are rejected with 400 Bad Request. Behavior is all-or-nothing: every record is committed in a single transaction, or nothing is. On success the endpoint returns 204 No Content.' operationId: usage_internal#batch_ingest requestBody: content: application/json: schema: $ref: '#/components/schemas/UsageBatchPayload' application/x-www-form-urlencoded: schema: $ref: '#/components/schemas/UsageBatchPayload' description: Batch of message-consumption counters to upsert required: true x-originalParamName: payload responses: '204': description: No Content '400': content: application/vnd.goa.error+json: schema: $ref: '#/components/schemas/error' description: Bad Request '403': content: application/vnd.goa.error+json: schema: $ref: '#/components/schemas/error' description: Forbidden '413': content: application/vnd.goa.error+json: schema: $ref: '#/components/schemas/error' description: Request Entity Too Large '500': content: application/vnd.goa.error+json: schema: $ref: '#/components/schemas/error' description: Internal Server Error summary: batch_ingest usage_internal tags: - usage_internal components: schemas: UserUsageRecord: description: One (user, thing, device, date) message counter delta properties: count: description: Delta number of messages for this (user, thing, device) on this date minimum: 0 type: integer date: description: Calendar day these counters refer to (UTC; truncated to day on persist) format: date-time type: string device_id: description: Device ID attached to the thing format: uuid type: string thing_id: description: Thing ID format: uuid type: string user_id: description: Owning user format: uuid type: string required: - user_id - thing_id - device_id - date - count title: UserUsageRecord type: object error: description: Error response media type (default view) properties: code: description: an application-specific error code, expressed as a string value. example: invalid_value type: string detail: description: a human-readable explanation specific to this occurrence of the problem. example: Value of ID must be an integer type: string id: description: a unique identifier for this particular occurrence of the problem. example: 3F1FKVRR type: string meta: additionalProperties: true description: a meta object containing non-standard meta-information about the error. example: timestamp: 1458609066 type: object status: description: the HTTP status code applicable to this problem, expressed as a string value. example: '400' type: string title: 'Mediatype identifier: application/vnd.goa.error+json; view=default' type: object UsageBatchPayload: description: Batch of message-consumption counters to upsert properties: orgs_usage: description: Per-organization counters. Composite key (org_id, thing_id, device_id, date) must be unique within this array. items: $ref: '#/components/schemas/OrgUsageRecord' maxItems: 10000 type: array users_usage: description: Per-user counters. Composite key (user_id, thing_id, device_id, date) must be unique within this array. items: $ref: '#/components/schemas/UserUsageRecord' maxItems: 10000 type: array title: UsageBatchPayload type: object OrgUsageRecord: description: One (org, thing, device, date) message counter delta properties: count: description: Delta number of messages for this (org, thing, device) on this date minimum: 0 type: integer date: description: Calendar day these counters refer to (UTC; truncated to day on persist) format: date-time type: string device_id: description: Device ID attached to the thing format: uuid type: string org_id: description: Owning organization format: uuid type: string thing_id: description: Thing ID format: uuid type: string required: - org_id - thing_id - device_id - date - count title: OrgUsageRecord type: object externalDocs: description: See docs on Confluence url: https://arduino.atlassian.net/wiki/spaces/FTWEB/pages/91160610/Arduino+IoT+Cloud