Create Device batch
Description
Create a new batch of Devices in a Product. The count
field determines the number of devices created. An optional array of fingerprints to configure for the devices can provided. If provided, the length of the fingerprints
array must equal count
Request
POST /v1/n5/products/:productId/devices/batch
{
count: number,
fingerprints?: string[],
tags?: {
[key: string]: string
}
}
Response
Successful response contains the following JSON formated body:
{
devices: {
productId: string,
deviceId: string,
name: string|null,
fingerprint: string|null,
batchId: number|null,
tags: {
[key: string]: string
},
created: string,
deleted: boolean
}[],
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/n5/products/:productId/devices/batch" \
-H "Authorization: Bearer <ApiKey>" \
-H "X-Nabto-Organization: <OrganizationId>" \
-H "Content-Type: application/json" \
-d '{ count: 42, fingerprints:[ "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",...], tags: {"foo": "bar" }}'
Response
{
devices: [{
productId: "pr-abcdefgh",
deviceId: "de-efghijkl",
name: "friendly name",
fingerprint: "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef",
batchId: 42,
tags: {
"foo": "bar"
},
created: "2022-10-18T10:17:24.299Z",
deleted: true
},
,
...] count: 42,
batchId: 42
}