Qeo Open Source Project Documentation : /realms/{id}/devices (POST)
Created by lissensj on May 21, 2014
Description: | Create or modify a single device of a user within a realm of a Qeo administrator |
URL Structure: | https://my.qeo.org/qeo-rest-service/v1/realms/{id}/devices |
HTTP Method: | POST |
Parameters: | HTTP Authorization Path parameter: identifier of the realm (value is of type long) For a Create: Body: Must contain the device name and de user identifier {"user":...,"name":"..."} Parameter: "user" : value of type long, identifier of the user where the device belongs to. "name" : UTF-8 string representing the name of the device Leading and trailing spaces are removed from the name. The provided name cannot be empty.
https://my.qeo.org/qeo-rest-service/v1/realms/103/devices
{
"user":12345,
"name":"Bedroom set-top box"
}
For a Modify: Body: Must contain the device name the device identifier and the associated user identifier {"id":...,"user":...,"name":"..."} Parameters: "id" : value of type long, representing the device identifier "user" : value of type long, identifier of the user where the device belongs to. "name" : UTF-8 string representing the name of the device Leading and trailing spaces are removed from the name. The provided name cannot be empty.
https://my.qeo.org/qeo-rest-service/v1/realms/103/devices
{
"id":5545,
"user":12345,
"name":"Bedroom set-top box"
}
|
Response: | For a Create: HTTP 201 Created Content-Type: application/json For a Modify: HTTP 200 OK Content-Type: application/json Body: Contains the created/modified device in JSON format as it is stored in the database: {"id":...,"realm":...,"user":...,"type":"device","device_id":"...","name":"...","state":"...","otc":{"code":"..","date":"..."} } The returned parameters for each device: "id" : value of type long, representing the device identifier "type" : type of object returned (always "device") "realm" : value of type long, represents the realm identifier where the device belongs to. "user" : value of type long, representing the user identifier where the device belongs to. "device_id" : UTF-8 string representing the devices own identifier "name" : UTF-8 string representing the name of the device in the realm "state" : a device has a certain state: "CREATING" : device is not yet enrolled, it is not yet ready to talk Qeo "ENROLLED": device is enrolled, it can talk Qeo "REVOKED" : device is revoked, it can no longer talk Qeo "otc" : - one time code to register your device and to place it in "ENROLLED" state. - otc is only available in case your device is in state "CREATING" - otc is valid for a short period of time - otc is composed of: "code": needed to register your device "date": creation date of the code, format:yyyy-MM-dd'T'HH:mm:ss.SSSZ yyyy: year MM: month in year dd: day of month HH: hour mm: minutes ss: seconds SSS: millisecond Z: time zone
{
"id":5545,
"realm":103,
"user":12345,
"type":"device",
"name":"Bedroom set-top box",
"state":"CREATING",
"device_id":"",
"otc":{
"code":"35676407",
"date":"2016-06-17T16:06:29.794+0200"
}
}
|