Channel service
Channel service is accessing for time series data storage channel management when it is associated with the device. To access the stream data stored in the channel, use Stream service(see Stream service).
List all channel(s)
List channel(s) of thingscale.
Request Header:
| Header: | Description |
|---|---|
| X-APITOKEN | API_TOKEN_HERE |
| X-WITHTAG | (boolean)show tags with channel |
(NOTE) Tag name is created when you want to put data containing tags in the channel.
Response Body:
| Elements | Type | Descritption |
|---|---|---|
| channel | number | channel-Id |
| tag | string | tag name |
| channel_name | string | channel description |
| last_update | string | last update time |
GET https://m.thingscale.io/v2/channel/{channel_id}
Parameters: channel_id (Integer)
Sample payload:
[
{
"channel": 0,
"tag": "node1",
"channel_name": "Sensinics 7F",
"last_update": "2015-05-10T21:24:50+0900"
}
]
curl -X GET -H "X-APITOKEN: API_TOKEN_HERE" -k https://m.thingscale.io/v2/channel/CHANNEL_ID_HERE
Response code:
| HTTP status: | Desc./Response body |
|---|---|
| 200 OK | Transaction OK. |
| 401 Unauthorized | {"error": "AUTH_REQUIRED"} |
| 404 Not found | {"error": "NO_CHANNEL"} |
Create a new channel
Create a channel of thingscale.
Request Header:
| Header: | Description |
|---|---|
| X-APITOKEN | API_TOKEN_HERE |
| X-TAGNAME | (string)tag name |
(NOTE)Tag name is created when you want to put data containing tags in the channel.
POST https://m.thingscale.io/v2/channel/{channel_id}
Parameters: channel_id (Integer)
curl -X POST -H "X-APITOKEN: API_TOKEN_HERE" -k https://m.thingscale.io/v2/channel/CHANNEL_ID_HERE
Response code:
| HTTP status: | Desc./Response body |
|---|---|
| 201 Created | Transaction OK. |
| 401 Unauthorized | {"error": "AUTH_REQUIRED"} |
| 403 Forbidden | { "error": "CHANNEL_INUSE" } // Because the same channel as the specified ID exists, it could not be created. |
| 404 Not found | {"error": "NO_CHANNEL"} |
Update a channel
Update a channel of thingscale.
Request Header:
| Header: | Description |
|---|---|
| X-APITOKEN | API_TOKEN_HERE |
| X-TAGNAME | (string)tag name |
(NOTE)Tag name is created when you want to put data containing tags in the channel.
Response Body:
| Elements | Type | Descritption |
|---|---|---|
| channel | number | channel-Id |
| tag | string | tag name |
| channel_name | string | channel description |
| last_update | string | last update time |
PUT https://m.thingscale.io/v2/channel/{channel_id}
Parameters: channel_id (Integer)
Sample body:
[
{
"channel": 0,
"tag": "node1",
"channel_name": "Sensinics 7F",
"last_update": "2015-05-10T21:24:50+0900"
}
]
curl -X PUT -H "X-APITOKEN: API_TOKEN_HERE" -k https://m.thingscale.io/v2/channel/CHANNEL_ID_HERE
Response code:
| HTTP status: | Desc./Response body |
|---|---|
| 201 Created | Transaction OK. |
| 400 Bad Request | { "error": "BAD_JSON_FORMAT" } // check json array. |
| 401 Unauthorized | {"error": "AUTH_REQUIRED"} |
| 404 Not found | {"error": "NO_CHANNEL"} |
Delete a channel
Delete a channel of thingscale.
Request Header:
| Header: | Description |
|---|---|
| X-APITOKEN | API_TOKEN_HERE |
| X-TAGNAME | (string)tag name |
(NOTE)Tag name is created when you want to put data containing tags in the channel.
DELETE https://m.thingscale.io/v2/channel/{channel_id}
Parameters: channel_id (Integer)
curl -X DELETE -H "X-APITOKEN: API_TOKEN_HERE" -k https://m.thingscale.io/v2/channel/CHANNEL_ID_HERE
Response code:
| HTTP status: | Desc./Response body |
|---|---|
| 201 Created | Transaction OK. |
| 401 Unauthorized | {"error": "AUTH_REQUIRED"} |
| 403 Forbidden | { "error": "CHANNEL_INUSE" } // Specified channel is used by device. |
| 404 Not found | { "error": "NO_CHANNEL" } // Specified channel is used by device. |