Create Device batch

Description

Create a new batch of Devices in a Product. The count field determines the number of devices created.

Request

POST /v1/webrtc/products/:productId/device-batch
{
  count: number,
  tags?: {
    [key: string]: string
  }
}

Response

Successful response contains the following JSON formated body:

{
  devices: {
     productId: string,
    deviceId: string,
    name: string|null,
    batchId: number|null,
    tags: {
      [key: string]: string
    },
    created: string 
  }[],
  count: number,
  batchId: number
}

Response Status codes:

  • 200 on success

Request headers

This request must have the following headers:

  • Authorization: bearer <ApiKey>
  • X-Nabto-Organization: <organizationId>
  • Content-Type: application/json

Example

Request

curl -XPOST "https://api.cloud.nabto.com/v1/webrtc/products/:productId/device-batch" \
  -H "Authorization: Bearer <ApiKey>" \
  -H "X-Nabto-Organization: <OrganizationId>" \
  -H "Content-Type: application/json" \
  -d '{ "count": 42, "tags": {"foo": "bar" }}'

Response

{
   "devices": [{
     "productId": "pr-abcdefgh",
    "deviceId": "a.mydomain.example.net",
    "name": "friendly name",
    "batchId": 42,
    "tags": {
      "foo": "bar" 
    },
    "created": "2022-10-18T10:17:24.299Z" 
  },
  ...],
  "count": 42,
  "batchId": 42
}