How to Provision Devices

Requirements

  • A Valid API Key: Provisioned and provided by your platform administrator.

  • A Organization Identifier: Provisioned and provided by your platform administrator. If you have enough permissions you can try to provision by sour self (see How to provision Organizations)

  • A Channel Identifier: Used to group devices in a organization. It mus be provided by your platform administrator or created by your self (see How to provision Channels).

If you have a channel previously create onw you can use the same identifier to group all new devices you like.

Method

POST

API Endpoint

/north/v80/provision/organizations/{organization_id}/entities/devices

New devices can be created by sending a POST request to the above defined URI, including a correctly formatted JSON document in the POST body.

The minimun fields you must complete are showed in the next example.

JSON example for device creation
Unresolved directive in opengate-api-quick-reference-howto-provision-devices.adoc - include::./json/dmmExamples/opengate-north-dmm-provision-device-minimum-example.json[]

Using curl to perform the request:

curl --request POST \
     --data-binary @opengate-north-dmm-provision-device-example.json \
     --header "X-ApiKey: YOUR_API_KEY_HERE" \
     --verbose \
     http://[your_opengate_address]/north/v80/provision/organizations/{organization_id}/entities/devices \
     -H "Content-type: application/json"

In the response we should see a status code of 201 (created) and a location header which tells us the location (including the assigned identifier) of the newly created device. Let’s look the response.

HTTP/1.1 201 Created
Location: http://[your_opengate_address]/north/v80/provision/organizations/{organization_id}/entities/devices/device_1