Devices: CRUD Device Types

The following are endpoints related to device types.

Create device type

Creates a new device type on the portal and creates a corresponding basic user on the IoT platform.

Summary

  • Endpoint: /device_type_create
  • Method: POST
  • Required User Type: SA

Body Parameters

  • name - device type name
    • Type: string
    • Required
  • description - device type description
    • Type: string
    • Optional
  • tag- see Managing and Using Device Types for more information
    • Type: string
    • Optional, required with tag_value
  • tag_value - see Managing and Using Device Types for more information
    • Type: any
    • Optional, required with tag 
  • image_url - see Managing and Using Device Types for more information
    • Type: string
    • Optional
  • custom_params - you can add some custom fields here
    • Type: dictionary
    • Optional

Response

A successful response will return the new device type's details.

 

Example

Request Body

{
name: "device type 1",
description: "This is my first device type",
tag_value: "device_type_1",
tag: "raw.device_type",
image_url: "https://sample.picture/device_type_1.png",
custom_params:{
"custom_field1":"field_value1",
"custom_field2":100
}
}

Response Data:

{
name: "device type 1",
description: "This is my first device type",
tag_value: "device_type_1",
tag: "raw.device_type",
image_url: "https://sample.picture/device_type_1.png",
custom_params:{
"custom_field1":"field_value1",
"custom_field2":100
},
device_type_id: "15792e4c-901f-4abf-8959-11ac21570a20",
api_basic_user: "dt_15792e4c-901f-4abf-8959-11ac21570a20"
}

 

Retrieve all device types

Get a list of all device types.

Summary

  • Endpoint: /device_type_list
  • Method: GET
  • Required User Type: Any user can use this endpoint

Response

A successful response will return an array of device type objects.

Example

Request

/device_type_list

Response Data

[
{
name: "device type 1",
description: "This is my first device type",
tag_value: "device_type_1",
tag: "raw.device_type",
image_url: "https://sample.picture/device_type_1.png",
custom_params:{
"custom_field1":"field_value1",
"custom_field2":100
},
device_type_id: "15792e4c-901f-4abf-8959-11ac21570a20",
api_basic_user: "dt_15792e4c-901f-4abf-8959-11ac21570a20"
}
]

 

Update a device type

Update an existing device type and mirror the data to the corresponding basic user in IoT platform.

Summary

  • Endpoint: /device_type_update
  • Method: POST
  • Required User Type: SA

Body Parameters

  • device_type_id - UUID for device type
    • Type: string
    • Required
  • name - device type name
    • Type: string
    • Required
  • description - device type description
    • Type: string
    • Optional
  • tag- see Managing and Using Device Types for more information
    • Type: string
    • Optional, required with tag_value
  • tag_value - see Managing and Using Device Types for more information
    • Type: any
    • Optional, required with tag 
  • image_url - see Managing and Using Device Types for more information
    • Type: string
    • Optional
  • custom_params - you can add some custom fields here
    • Type: dictionary
    • Optional

Response

A successful response will return the updated device type object.

Example

Request Body

{
device_type_id: "15792e4c-901f-4abf-8959-11ac21570a20",
name: "device type 1",
description: "This is my first device type",
tag_value: "device_type_1",
tag: "raw.device_type",
image_url: "https://sample.picture/device_type_1.png",
custom_params:{
"custom_field1":"field_value1",
"custom_field2":100
}
}

Response Data

{
name: "device type 1",
description: "This is my first device type",
tag_value: "device_type_1",
tag: "raw.device_type",
image_url: "https://sample.picture/device_type_1.png",
custom_params:{
"custom_field1":"field_value1",
"custom_field2":100
},
device_type_id: "15792e4c-901f-4abf-8959-11ac21570a20",
api_basic_user: "dt_15792e4c-901f-4abf-8959-11ac21570a20"
}

 

 

Link device type to device

Link a device type to a device. If a TA uses this endpoint, then the device must be linked to the tenant.

Summary

  • Endpoint: /device_type_link
  • Method: GET
  • Required User Type: TA or SA

URL Parameters

  • device_id - device
  • device_type_id - UUID for device type
    • Type: string

Response

A successful response will be a simple 200 response.

Example

Request

/device_type_link?device_id=device_id_1&device_type_id=15792e4c-901f-4abf-8959-11ac21570a20

Response Data

 

 

Delete a device type

Documentation coming soon!