项目管理类API
更新时间:2018-10-18 19:48:14
创建工业项目
定义描述
path |
版本 |
描述 |
/industry/project/create |
1.0.6 |
创建工业项目 |
请求参数
名称 |
类型 |
必要 |
描述 |
projectName |
String |
是 |
项目名称 |
description |
String |
否 |
项目描述信息 |
请求示例
private static ApiRequest buildRequest() throws UnsupportedEncodingException {
String host = "api.link.aliyun.com";
String path = "/industry/project/create";
JSONObject request = new JSONObject();
request.put("apiVer", "1.0.6");
JSONObject params = new JSONObject();
params.put("projectName", "industry");
params.put("description", "my project demo");
JSONObject requestBody = new JSONObject();
requestBody.put("id", System.currentTimeMillis());
requestBody.put("version", "1.0");
requestBody.put("request", request);
requestBody.put("params", params);
System.out.println(requestBody.toJSONString());
byte[] body = requestBody.toJSONString().getBytes("UTF-8");
ApiRequest apiRequest = new ApiRequest(Scheme.HTTPS, Method.POST_BODY, host, path, body);
apiRequest.getHeaders().put("accept", "application/json");
return apiRequest;
}
返回示例
{
"code": 200,
"data": {
"appDevKey": "24967xxxx",
"appDevSecret": "c43471421ba308da0421xxxxxxx",
"description": "xili_project",
"appKey": "24967xxx",
"appSecret": "ecc03ba2a5c37450337cxxxxx",
"projectName": "xili_project",
"projectId": "a124oOBkoxxxx"
},
"id": "4132a23b-4160-4b48-b296-77a1b8fc2bb8"
}
查询工业项目
定义描述
path |
版本 |
描述 |
/industry/project/query |
1.0.6 |
查询工业项目 |
请求参数
名称 |
类型 |
必要 |
描述 |
projectId |
String |
是 |
项目Id |
请求示例
private static ApiRequest buildRequest() throws UnsupportedEncodingException {
String host = "api.link.aliyun.com";
String path = "/industry/project/query";
JSONObject request = new JSONObject();
request.put("apiVer", "1.0.6");
JSONObject params = new JSONObject();
params.put("projectId", "a124f2zsQNXrT4KW");
JSONObject requestBody = new JSONObject();
requestBody.put("id", System.currentTimeMillis());
requestBody.put("version", "1.0");
requestBody.put("request", request);
requestBody.put("params", params);
System.out.println(requestBody.toJSONString());
byte[] body = requestBody.toJSONString().getBytes("UTF-8");
ApiRequest apiRequest = new ApiRequest(Scheme.HTTPS, Method.POST_BODY, host, path, body);
apiRequest.getHeaders().put("accept", "application/json");
return apiRequest;
}
返回示例
{
"code": 200,
"data": {
"appDevKey": "250xxxxxx",
"appDevSecret": "bfb4952e812b34f9128bccfaxxxx",
"description": "my project demo",
"appKey": "25091xxxx",
"appSecret": "3411ce1ca78327868f449120xxxxxxxx",
"projectName": "industry",
"projectId": "a124f2zsQNXrT4KW"
},
"id": "1537950032739"
}
根据名称查询项目列表
定义描述
path |
版本 |
描述 |
/industry/project/queryByName |
1.0.6 |
根据项目名称查询项目列表 |
请求参数
名称 |
类型 |
必要 |
描述 |
projectName |
String |
是 |
项目名称 |
请求示例
private static ApiRequest buildRequest() throws UnsupportedEncodingException {
String host = "api.link.aliyun.com";
String path = "/industry/project/queryByName";
JSONObject request = new JSONObject();
request.put("apiVer", "1.0.6");
JSONObject params = new JSONObject();
params.put("projectName", "industry");
JSONObject requestBody = new JSONObject();
requestBody.put("id", System.currentTimeMillis());
requestBody.put("version", "1.0");
requestBody.put("request", request);
requestBody.put("params", params);
System.out.println(requestBody.toJSONString());
byte[] body = requestBody.toJSONString().getBytes("UTF-8");
ApiRequest apiRequest = new ApiRequest(Scheme.HTTPS, Method.POST_BODY, host, path, body);
apiRequest.getHeaders().put("accept", "application/json");
return apiRequest;
}
返回示例
{
"code": 200,
"data": [{
"appDevKey": "25091xxxx",
"appDevSecret": "bfb4952e812b34f9128bccfxxxxxx",
"description": "my project demo",
"appKey": "25091xxxxx",
"appSecret": "3411ce1ca78327868f44912xxxxxx",
"projectName": "industry",
"projectId": "a124f2zsQNXrT4KW"
}],
"id": "1537950227081"
}
查询租户所有工业项目
定义描述
path |
版本 |
描述 |
/industry/project/queryAll |
1.0.6 |
查询租户下的所有项目信息 |
请求参数
请求示例
private static ApiRequest buildRequest() throws UnsupportedEncodingException {
String host = "api.link.aliyun.com";
String path = "/industry/project/queryAll";
JSONObject request = new JSONObject();
request.put("apiVer", "1.0.6");
JSONObject requestBody = new JSONObject();
requestBody.put("id", System.currentTimeMillis());
requestBody.put("version", "1.0");
requestBody.put("request", request);
System.out.println(requestBody.toJSONString());
byte[] body = requestBody.toJSONString().getBytes("UTF-8");
ApiRequest apiRequest = new ApiRequest(Scheme.HTTPS, Method.POST_BODY, host, path, body);
apiRequest.getHeaders().put("accept", "application/json");
return apiRequest;
}
返回示例
{
"code": 200,
"data": [{
"appDevKey": "25091106",
"description": "my project demo",
"appKey": "25091107",
"projectName": "industry",
"projectId": "a124f2zsQNXrT4KW"
}, {
"appDevKey": "25089738",
"description": "qwertyuiolasdfghjklqwertyuioasdf",
"appKey": "25089584",
"projectName": "qwertyuiolasdfghjklqwertyuioasdf",
"projectId": "a124Uqc9EeOkJq79"
}, {
"appDevKey": "25038349",
"description": "test1",
"appKey": "25038685",
"projectName": "test1",
"projectId": "a1245SiDbLx5HE4S"
}],
"id": "1537950357221"
}
查询项目下设备信息
定义描述
path |
版本 |
描述 |
/industry/project/pageQueryDevice |
1.0.6 |
分页查询项目下的设备信息 |
请求参数
名称 |
类型 |
必要 |
描述 |
projectId |
String |
是 |
项目Id |
currentPage |
Integer |
是 |
当然页数,从1开始 |
pageSize |
Integer |
是 |
分页大小, 最大200 |
请求示例
private static ApiRequest buildRequest() throws UnsupportedEncodingException {
String host = "api.link.aliyun.com";
String path = "/industry/project/pageQueryDevice";
JSONObject request = new JSONObject();
request.put("apiVer", "1.0.6");
JSONObject params = new JSONObject();
params.put("projectId", "a124DAH1YiMEg7mt");
params.put("currentPage", 1);
params.put("pageSize", 2);
JSONObject requestBody = new JSONObject();
requestBody.put("id", System.currentTimeMillis());
requestBody.put("version", "1.0");
requestBody.put("request", request);
requestBody.put("params", params);
System.out.println(requestBody.toJSONString());
byte[] body = requestBody.toJSONString().getBytes("UTF-8");
ApiRequest apiRequest = new ApiRequest(Scheme.HTTPS, Method.POST_BODY, host, path, body);
apiRequest.getHeaders().put("accept", "application/json");
return apiRequest;
}
返回示例
{
"code": 200,
"data": {
"totalNum": 4,
"items": [
{
"latestOnlineTime": 1531734163000,
"iotId": "tQ549OEnnBmxT1pGMBjp0010a7f800",
"activeTime": 1531720265000,
"attributes": {},
"productKey": "a1Kk7RWl7F0",
"deviceName": "tQ549OEnnBmxT1pGMBjp",
"status": 3
},
{
"latestOnlineTime": 1519732636000,
"iotId": "HVKsogc1Usj63nxcMWqK0010b0f900",
"nickName": "deviceTagName",
"activeTime": 1519364998000,
"attributes": {
"location": "西溪8号楼"
},
"productKey": "a1Kk7RWl7F0",
"deviceName": "HVKsogc1Usj63nxcMWqK",
"tags": {
"location": "西溪8号楼"
},
"status": 3
},
{
"latestOnlineTime": 1518170955000,
"iotId": "SycRF2hchF6Pq38Ao0vi001084d400",
"activeTime": 1518170954000,
"attributes": {},
"productKey": "a1Kk7RWl7F0",
"deviceName": "SycRF2hchF6Pq38Ao0vi",
"status": 3
},
{
"latestOnlineTime": 1517818744000,
"iotId": "oC3QdEmjoQPlckZSApAF0010224b00",
"activeTime": 1517540623000,
"attributes": {},
"productKey": "a1Kk7RWl7F0",
"deviceName": "oC3QdEmjoQPlckZSApAF",
"status": 3
}
]
},
"id": "85fe49a2-e837-474b-b9cd-0a64eabd28c3"
}
别名搜索设备
定义描述
path |
版本 |
描述 |
/industry/project/queryDeviceByNickName |
1.0.6 |
项目下,根据设备别名查询设备 |
请求参数
名称 |
类型 |
必要 |
描述 |
projectId |
String |
是 |
项目Id |
nickName |
String |
是 |
设备别名 |
请求示例
private static ApiRequest buildRequest() throws UnsupportedEncodingException {
String host = "api.link.aliyun.com";
String path = "/industry/project/queryDeviceByNickName";
JSONObject request = new JSONObject();
request.put("apiVer", "1.0.6");
JSONObject params = new JSONObject();
params.put("projectId", "a124DAH1YiMEg7mt");
params.put("nickName", "test");
JSONObject requestBody = new JSONObject();
requestBody.put("id", System.currentTimeMillis());
requestBody.put("version", "1.0");
requestBody.put("request", request);
requestBody.put("params", params);
System.out.println(requestBody.toJSONString());
byte[] body = requestBody.toJSONString().getBytes("UTF-8");
ApiRequest apiRequest = new ApiRequest(Scheme.HTTPS, Method.POST_BODY, host, path, body);
apiRequest.getHeaders().put("accept", "application/json");
return apiRequest;
}
返回示例
{
"code": 200,
"data": [{
"nickName": "test",
"productKey": "a1k3yOhhxRW",
"deviceName": "datLtaor5o5cIfOAdHmY",
"productName": "industry_prod",
"tags": {
"one": "two"
},
"iotId": "datLtaor5o5cIfOAdHmY0010007e00",
"attributes": {
"one": "two"
},
"projectName": "test1",
"projectId": "a124DAH1YiMEg7mt",
"status": 0
}],
"id": "1537950790907"
}
设备和项目关联
定义描述
path |
版本 |
描述 |
/industry/project/modifyDeviceRelation |
1.0.6 |
设备和项目关联起来 |
请求参数
名称 |
类型 |
必要 |
描述 |
projectId |
String |
是 |
项目Id |
productKey |
String |
是 |
产品Key |
deviceName |
String |
是 |
设备名称 |
请求示例
private static ApiRequest buildRequest() throws UnsupportedEncodingException {
String host = "api.link.aliyun.com";
String path = "/industry/project/modifyDeviceRelation";
JSONObject request = new JSONObject();
request.put("apiVer", "1.0.6");
JSONObject params = new JSONObject();
params.put("projectId", "a124DAH1YiMEg7mt");
params.put("productKey", "a1k3yOhhxRW");
params.put("deviceName", "5atWGVtgmH7IMNA5kawh");
JSONObject requestBody = new JSONObject();
requestBody.put("id", System.currentTimeMillis());
requestBody.put("version", "1.0");
requestBody.put("request", request);
requestBody.put("params", params);
System.out.println(requestBody.toJSONString());
byte[] body = requestBody.toJSONString().getBytes("UTF-8");
ApiRequest apiRequest = new ApiRequest(Scheme.HTTPS, Method.POST_BODY, host, path, body);
apiRequest.getHeaders().put("accept", "application/json");
return apiRequest;
}
返回示例
{
"code": 200,
"data": "",
"id": "dd1b91a0-6333-472b-8501-e7f7e8dc6e2c"
}
批量设备和项目关联
定义描述
path |
版本 |
描述 |
/industry/project/batchModifyDeviceRelation |
1.0.6 |
批量添加设备和项目的关联关系 |
请求参数
名称 |
类型 |
必要 |
描述 |
projectId |
String |
是 |
项目Id |
deviceList |
List |
是 |
设备列表 |
请求示例
private static ApiRequest buildRequest() throws UnsupportedEncodingException {
String host = "api.link.aliyun.com";
String path = "/industry/project/batchModifyDeviceRelation";
JSONObject request = new JSONObject();
request.put("apiVer", "1.0.6");
JSONObject params = new JSONObject();
params.put("projectId", "a124DAH1YiMEg7mt");
List<Map<String, String>> deviceList = Lists.newArrayList();
Map<String, String> device1 = Maps.newHashMap();
device1.put("productKey", "a1k3yOhhxRW");
device1.put("deviceName", "kbebpPeyCondV5CkacBG");
Map<String, String> device2 = Maps.newHashMap();
device2.put("productKey", "a1k3yOhhxRW");
device2.put("deviceName", "yMYkJtkj201J28FajvdT");
deviceList.add(device1);
deviceList.add(device2);
params.put("deviceList", deviceList);
JSONObject requestBody = new JSONObject();
requestBody.put("id", System.currentTimeMillis());
requestBody.put("version", "1.0");
requestBody.put("request", request);
requestBody.put("params", params);
System.out.println(requestBody.toJSONString());
byte[] body = requestBody.toJSONString().getBytes("UTF-8");
ApiRequest apiRequest = new ApiRequest(Scheme.HTTPS, Method.POST_BODY, host, path, body);
apiRequest.getHeaders().put("accept", "application/json");
return apiRequest;
}
返回示例
{
"code": 200,
"data": "",
"id": "dd1b91a0-6333-472b-8501-e7f7e8dc6e2c"
}
修改设备别名
定义描述
path |
版本 |
描述 |
/industry/project/updateNickName |
1.0.6 |
修改设备别名 |
请求参数
名称 |
类型 |
必要 |
描述 |
productKey |
String |
是 |
产品Key |
deviceName |
String |
是 |
设备名称 |
nickName |
String |
是 |
设备别名 |
attributes |
JSON |
否 |
设备标签列表 |
请求示例
private static ApiRequest buildRequest() throws UnsupportedEncodingException {
String host = "api.link.aliyun.com";
String path = "/industry/project/updateNickname";
JSONObject request = new JSONObject();
request.put("apiVer", "1.0.6");
JSONObject params = new JSONObject();
params.put("productKey", "a1k3yOhhxRW");
params.put("deviceName", "hello2");
params.put("nickName", "industry_nick");
JSONObject requestBody = new JSONObject();
requestBody.put("id", System.currentTimeMillis());
requestBody.put("version", "1.0");
requestBody.put("request", request);
requestBody.put("params", params);
System.out.println(requestBody.toJSONString());
byte[] body = requestBody.toJSONString().getBytes("UTF-8");
ApiRequest apiRequest = new ApiRequest(Scheme.HTTPS, Method.POST_BODY, host, path, body);
apiRequest.getHeaders().put("accept", "application/json");
return apiRequest;
}
返回示例
{
"code": 200,
"data": "",
"id": "dd1b91a0-6333-472b-8501-e7f7e8dc6e2c"
}
搜索设备
定义描述
path |
版本 |
描述 |
/industry/project/queryDeviceByCondition |
1.0.6 |
搜索设备 |
请求参数
名称 |
类型 |
必要 |
描述 |
productKey |
String |
否 |
产品Key |
deviceName |
String |
否 |
设备名称 |
nickName |
String |
否 |
设备别名 |
attributes |
JSON |
否 |
设备标签列表 |
status |
Integer |
否 |
设备状态,0:未激活,1:在线,3:离线,8:禁用 |
currentPage |
Integer |
是 |
当前页数,从1开始 |
pageSize |
Integer |
是 |
页数大小,最大40 |
projectId |
String |
否 |
项目Id |
请求示例
private static ApiRequest buildRequest() throws UnsupportedEncodingException {
String host = "api.link.aliyun.com";
String path = "/industry/project/queryDeviceByCondition";
JSONObject request = new JSONObject();
request.put("apiVer", "1.0.6");
JSONObject params = new JSONObject();
params.put("productKey", "a1k3yOhhxRW");
params.put("currentPage", 1);
params.put("pageSize", 5);
JSONObject requestBody = new JSONObject();
requestBody.put("id", System.currentTimeMillis());
requestBody.put("version", "1.0");
requestBody.put("request", request);
requestBody.put("params", params);
System.out.println(requestBody.toJSONString());
byte[] body = requestBody.toJSONString().getBytes("UTF-8");
ApiRequest apiRequest = new ApiRequest(Scheme.HTTPS, Method.POST_BODY, host, path, body);
apiRequest.getHeaders().put("accept", "application/json");
return apiRequest;
}
返回示例
{
"code": 200,
"data": {
"totalNum": 9,
"items": [{
"productKey": "a1k3yOhhxRW",
"deviceName": "datLtaor5o5cIfOAdHmY",
"productName": "industry_prod",
"iotId": "datLtaor5o5cIfOAdHmY0010007e00",
"attributes": {},
"status": 0
}, {
"productKey": "a1k3yOhhxRW",
"deviceName": "Pxf67BT578xalGnnPs3v",
"productName": "industry_prod",
"iotId": "Pxf67BT578xalGnnPs3v0010aa9100",
"attributes": {},
"status": 0
}]
},
"id": "1537948161974"
}
添加设备标签
定义描述
path |
版本 |
描述 |
/industry/project/addDeviceTags |
1.0.6 |
给设备添加标签 |
请求参数
名称 |
类型 |
必要 |
描述 |
productKey |
String |
是 |
产品Key |
deviceName |
String |
是 |
设备名称 |
tags |
JSON |
是 |
设备标签 |
请求示例
private static ApiRequest buildRequest() throws UnsupportedEncodingException {
String host = "api.link.aliyun.com";
String path = "/industry/project/addDeviceTags";
JSONObject request = new JSONObject();
request.put("apiVer", "1.0.6");
JSONObject params = new JSONObject();
params.put("productKey", "a1k3yOhhxRW");
params.put("deviceName", "Pxf67BT578xalGnnPs3v");
Map<String, String> tagMap = Maps.newHashMap();
tagMap.put("tagName", "nickname");
tagMap.put("tagValue", "industry");
List<Map<String, String>> tagLists = Lists.newArrayList();
tagLists.add(tagMap);
params.put("tags", tagLists);
JSONObject requestBody = new JSONObject();
requestBody.put("id", System.currentTimeMillis());
requestBody.put("version", "1.0");
requestBody.put("request", request);
requestBody.put("params", params);
System.out.println(requestBody.toJSONString());
byte[] body = requestBody.toJSONString().getBytes("UTF-8");
ApiRequest apiRequest = new ApiRequest(Scheme.HTTPS, Method.POST_BODY, host, path, body);
apiRequest.getHeaders().put("accept", "application/json");
return apiRequest;
}
返回示例
{
"code": 200,
"data": "",
"id": "dd1b91a0-6333-472b-8501-e7f7e8dc6e2c"
}
获取设备标签
定义描述
path |
版本 |
描述 |
/industry/project/getDeviceTags |
1.0.6 |
获取设备标签 |
请求参数
名称 |
类型 |
必要 |
描述 |
productKey |
String |
是 |
产品Key |
deviceName |
String |
是 |
设备名称 |
请求示例
private static ApiRequest buildRequest() throws UnsupportedEncodingException {
String host = "api.link.aliyun.com";
String path = "/industry/project/getDeviceTags";
JSONObject request = new JSONObject();
request.put("apiVer", "1.0.6");
JSONObject params = new JSONObject();
params.put("productKey", "a1k3yOhhxRW");
params.put("deviceName", "Pxf67BT578xalGnnPs3v");
JSONObject requestBody = new JSONObject();
requestBody.put("id", System.currentTimeMillis());
requestBody.put("version", "1.0");
requestBody.put("request", request);
requestBody.put("params", params);
System.out.println(requestBody.toJSONString());
byte[] body = requestBody.toJSONString().getBytes("UTF-8");
ApiRequest apiRequest = new ApiRequest(Scheme.HTTPS, Method.POST_BODY, host, path, body);
apiRequest.getHeaders().put("accept", "application/json");
return apiRequest;
}
返回示例
{
"code": 200,
"data": [{
"tagValue": "industry",
"tagName": "nickname"
}],
"id": "1537948789199"
}
删除设备标签
定义描述
path |
版本 |
描述 |
/industry/project/removeDeviceTags |
1.0.6 |
删除设备标签 |
请求参数
名称 |
类型 |
必要 |
描述 |
productKey |
String |
是 |
产品Key |
deviceName |
String |
是 |
设备名称 |
tags |
JSON |
是 |
设备标签 |
请求示例
private static ApiRequest buildRequest() throws UnsupportedEncodingException {
String host = "api.link.aliyun.com";
String path = "/industry/project/removeDeviceTags";
JSONObject request = new JSONObject();
request.put("apiVer", "1.0.6");
JSONObject params = new JSONObject();
params.put("productKey", "a1k3yOhhxRW");
params.put("deviceName", "Pxf67BT578xalGnnPs3v");
Map<String, String> tagMap = Maps.newHashMap();
tagMap.put("tagName", "nickname");
tagMap.put("tagValue", "industry");
List<Map<String, String>> tagLists = Lists.newArrayList();
tagLists.add(tagMap);
params.put("tags", tagLists);
JSONObject requestBody = new JSONObject();
requestBody.put("id", System.currentTimeMillis());
requestBody.put("version", "1.0");
requestBody.put("request", request);
requestBody.put("params", params);
System.out.println(requestBody.toJSONString());
byte[] body = requestBody.toJSONString().getBytes("UTF-8");
ApiRequest apiRequest = new ApiRequest(Scheme.HTTPS, Method.POST_BODY, host, path, body);
apiRequest.getHeaders().put("accept", "application/json");
return apiRequest;
}
返回示例
{
"code": 200,
"data": "",
"id": "1537949032567"
}