Add apikey
Request format: POST
URL: http://api.onenet.hk.chinamobile.com/keys
http body parameter
Name |
Format |
Required or not |
Description |
title |
string |
Yes |
Apikey name |
permissions |
array- json |
Yes |
Array of permission description objects. See the description table of permissions. |
access_methods |
array- string |
No |
Authorized access mode, with the options as follows: post: New resource get: Query resource put: Update resource delete: delete resource Note: There is no permission by default. |
Permissions description list
Name |
Format |
Description |
resources |
array- json |
List of authorized access resources See the description table of resources. |
Description table of resources
Name |
Format |
Description |
dev_id |
string |
Device ID of authorized access |
ds_id |
string |
Data stream ID of authorized access |
Return Parameters
Name |
Format |
Description |
errno |
int |
Call error code, where 0 means success. |
error |
string |
Error description. “succ” means the call is successful. |
data |
json |
For the apikey information returned after the interface is called successfully, see the data description table. |
Data Description Table
Name |
Format |
Description |
key |
string |
apikey assigned by the system |
POST http://api.onenet.hk.chinamobile.com/keys HTTP/1.1
Example of request body
{
"title": "newapikey",
"permissions": [{
"resources": [{
"dev_id": "39593230",
"ds_id": "gps"
}, {
"dev_id": "39456825"
}]
}],
"access_methods": ["get", "put", "post", "delete"]
}
Return Example
{
"errno":0,
"data": {
"key":"Ave*************lIRHxA="
},
"error":"succ"
}