Bulk Device Creation
In order to provision a set of devices in bulk, EdgeIQ has a few methods for creating a number of devices in the system at once. The most flexible and programmatic way to create multiple devices is through the API, but CSV functionality is available as well.
Bulk Create API Endpoints
-
POST /devices/bulk
: Using this request, you provide what is essentially a device template along with a list of unique device identifiers (see Bulk Device API documentation). -
POST /device_templates/{device_template_id}/bulk_create
: Bulk create devices for the given array of unique device identifiers based on the referenced Device Template (see Bulk Device API documentation). -
Bulk creates are limited to 1000 records at a time. To create more, split your requests over multiple bulk creates
NOTE: Bulk API requests will return a Bulk Response ID which can be used to monitor the status of the Bulk Create request using the GET /bulk_responses/{bulk_response_id}
request, see the Bulk Devices API documentation for more information.
CSV Upload
It's also possible to define a set of devices to be created using a CSV file. This file can be uploaded via the /devices/csv_bulk_upload
endpoint. The endpoint will process 1000 rows at a time, so to upload more, break the devices into multiple files.
Position | Field | Description | ||
---|---|---|---|---|
1 | Name | Device name | ||
2 | Unique ID | Unique identifier of device. Unique IDs must be globally unique. Please note that unique id is case sensitive, and unique ids for gateway type devices should be all lowercase if using the default auto discovered unique id (MAC address). | ||
3 | Serial Number | [Optional] An optional serial number for the device | ||
4 | Location | [Optional] A string describing the location of the device | ||
5 | Company ID | ID of the company account for this device | ||
6 | DeviceType ID | The ID of the device type for this device | ||
7 | Heartbeat Period | Heartbeat period in seconds | ||
8 | Cellular Number | [Optional] Cellular number associated with device | ||
9 | SMS Command Password | [Optional] Password for issuing commands via SMS | ||
10 | DeviceConfig ID | [Optional] ID of configuration to apply to these devices | ||
11 | Active | [Optional] true or false to mark the device active or inactive | ||
12 | Heartbeat Values | [Optional] A comma-separated list of values to send along with heartbeat messages. Must be surrounded in quotes, e.g. "disk_size,disk_free" | ||
13 | Device Integration ID | [Optional] ID of a device integration to assign to the device | ||
14 | Cloud Native Integration ID | [Optional] ID of a cloud-native integration to assign to the device | ||
15 | Parent Device ID | [Optional] If the device is a sensor-type device, or endpoint, the ID (not unique ID) of the parent device | ||
16 | Tags | [Optional] Semicolon delimited list of tags to apply to this device, e.g. tag 1;tag 2 | ||
17 | Metadata | [Optional] Metadata to apply to this device. Semicolon delimited, colon-separated key-value pairs, e.g. Current Firmware:v1.5;Color:blue | ||
18 | Enforce Secure MQTT | [Optional] Set to true if devices need to connect securely over MQTT (requires edge version >=3.x) | ||
19 | MQTT Password | [Optional] Set an MQTT password for devices (leave empty to use the default shared password) | ||
20 | Delete? | [Optional] In order to bulk delete, you may put true in this column. The device will be deleted | ||
21 | Update? | [Optional] In order to bulk update, you may put true in this column. Any new data will be updated, except forUnique ID DeviceType ID . |
For a template, here is an example file to get you started.
See the Device API documentation for more information about the upload endpoint.
Updated 5 months ago