If you are not ingesting your data using Platform Service , you can add dimensions to a device type using a REST API or through the Set up assets page on the user interfacce
Use the following REST API endpoint to add dimensions:
POST /entityType/{{entityTypeName}}/dimensional
Note: You must include Content-Type: application/json
in the HTTP header.
A third-party application, such as Postman, can be used to make the REST API call. Postman is available to download at https://www.getpostman.com/.
Restriction: You cannot add dimensions to a device type that was simulated by using the device simulator or using the sample device type templates.
If you are ingesting data through Platform Service, you can add dimensions when you register a device. For more information, see Adding dimenions.
Complete these steps to add dimensions.
Before you use the API, gather the following information:
http://api-{{geo_country_code}}.connectedproducts.internetofthings.ibmcloud.com/api/master/v1/{{tenant}}/
.us
, or uk
, or de
. If you are in the beta environment, use beta
as the country code.Define the following key value pairs for the header:
Key | Value |
---|---|
Content-Type |
application/json |
x-api-key |
enter_key |
x-api-token |
enter_token |
Define the JSON payload for creating dimension types and values using the following format:
[
{
"id": "string",
"name": "string",
"type": "NUMBER", "BOOLEAN", or "LITERAL"
"value": <literal>, <number>, or <TRUE or FALSE>
}
]
Where id
is the device ID, name
is the name of the dimension you are creating, and value
is the dimension value for the device.
Example:
[
{
"id": "car1",
"name" : "FLEET",
"type" : "NUMBER",
"value" : 8
},
{
"id": "car2",
"name" : "FLEET",
"type" : "NUMBER",
"value" : 15
},
{
"id": "car1",
"name" : "COLOR",
"type" : "LITERAL",
"value" : "yellow"
},
{
"id": "car2",
"name" : "COLOR",
"type" : "LITERAL",
"value" : "red"
}
]
The example shows dimension data for two entities, car1
and car2
. Both entities are assigned a fleet number and a color.
Note Do not use reserved names, for example, SQL reserved words, as dimension names.
Enter the URL in the URL field.
Example:
https://api-us.connectedproducts.internetofthings.ibmcloud.com/api/master/v1/Sample_Tenant/entityType/Sample_Robot_Type/dimensional
Select the Headers tab.