Brief description:
- Modify device
Interface version:
Version number | Developer | Development date | Revision date |
---|---|---|---|
2.0.0 | Lenny | 2023-04-07 |
Request URL:
- http://icloud.assetscontrols.com:8092/OpenApi/Admin
- https://icloud.assetscontrols.com:3443/OpenApi/Admin
Request method:
- POST
Request header:
Parameter name | Required | Type | Description |
---|---|---|---|
Content-Type | Yes | string | Request type: application/json |
Request parameters:
Parameter name | Required | Type | Description |
---|---|---|---|
FTokenID | Yes | string | Token ID |
FAction | Yes | string | Method name (UpdateAdminAsset) |
FT_AdminAsset | Yes | Object | {“FGUID”: unique identifier of the device, “FVehicleGUID”: unique identifier of the vehicle (not passed means unbinding), “FAssetID”: device ID, “FAssetTypeID”: device type, “FSIMNumber”: SIM card number, “FIMEI”: IMEI number, “FCustomerID”: device number, “FDescription”: description, “FAgentGUID”: unique identifier of the company} |
Return example:
Returned correctly:
{
"Result": 200,
"Message": "check token success",
"FObject": []
}
Returned incorrectly:
{
"Result": 102,
"Message": "Action is error",
"FObject": []
}
Return parameter description:
Parameter name | Type | Description |
---|---|---|
Result | int | Return result code |
Message | string | Return message |
FObject | object | Returned object |
Remarks:
- More return error codes are as follows:
- 104: Token error or expired
- 105: System exception
- 102: Request parameter error
- 107: There is an existing device number
Request example:
Java:
String result = "";
//Request path
String url = "http://cloud.assetscontrols.com:8092/OpenApi/Admin";
//Request parameters, json format parameters, it is recommended to use objects for transmission
String body = "{FAction:\"UpdateAdminAsset\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\",FT_AdminAsset:\"{"FGUID":"5baf6ccb-478e-4a13-91a6-6805ef93b7a7","FVehicleGUID":"9b32070e-6cf5-4995-8c60-4d250e6256f8","FAssetID":"645342344","FAssetTypeID":701,"FSIMNumber":"","FIMEI":"","FCustomerID":"","FDescription":"","FAgentGUID":"661e7209-c77e-4a54-afb8-6d956f962bdf"}";
URL realUrl = new URL(url);
// Set the properties of general request
URLConnection conn = realUrl.openConnection();
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("connection", "keep-Alive");
conn.setRequestProperty("Content-Type", "application/json");
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
conn.setRequestProperty("method", "post");
// Sending a POST request must set the following two lines
conn.setDoOutput(true);
conn.setDoInput(true);
PrintWriter pw = new PrintWriter(conn.getOutputStream());
// Send request parameters
pw.print(body);
// flush output stream buffer
pw.flush();
// Define BufferedReader input stream to read URL response
BufferedReader bufReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
// Define BufferedReader input stream to read URL response
String line;
while ((line = bufReader.readLine()) != null) {
result += line;
}
//Returns the JSON string
return result;
C#:
// Request path
string url = "http://cloud.assetscontrols.com:8092/OpenApi/Admin";
// Request parameters in JSON format. It is recommended to use objects for transmission.
string body = "{FAction:\"UpdateAdminAsset\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\",FT_AdminAsset:\"{"FGUID":"5baf6ccb-478e-4a13-91a6-6805ef93b7a7","FVehicleGUID":"9b32070e-6cf5-4995-8c60-4d250e6256f8","FAssetID":"645342344","FAssetTypeID":701,"FSIMNumber":"","FIMEI":"","FCustomerID":"","FDescription":"","FAgentGUID":"661e7209-c77e-4a54-afb8-6d956f962bdf"}\"}";
Encoding encoding = Encoding.UTF8;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
// Request method - POST or GET
request.Method = "post";
request.Accept = "*/*";
request.ContentType = "application/json";
request.UserAgent = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)";
byte[] buffer = encoding.GetBytes(body);
request.ContentLength = buffer.Length;
request.GetRequestStream().Write(buffer, 0, buffer.Length);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
{
// The response is returned as a JSON string
return reader.ReadToEnd();
}
Python:
url = 'http://cloud.assetscontrols.com:8092/OpenApi/Admin'
data = {
'FAction': 'UpdateAdminAsset',
'FTokenID': '3acef045-d302-4032-b40a-d9ee6c1519cd',
'FT_AdminAsset': '{"FGUID":"5baf6ccb-478e-4a13-91a6-6805ef93b7a7","FVehicleGUID":"9b32070e-6cf5-4995-8c60-4d250e6256f8","FAssetID":"645342344","FAssetTypeID":701,"FSIMNumber":"","FIMEI":"","FCustomerID":"","FDescription":"","FAgentGUID":"661e7209-c77e-4a54-afb8-6d956f962bdf"}'
}
data = parse.urlencode(data).encode('utf-8')
headers = {
'User-Agent': r'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) '
r'Chrome/45.0.2454.85 Safari/537.36 115Browser/6.0.3',
'Connection': 'keep-alive'
}
req = request.Request(url, headers=headers, data=data)
page = request.urlopen(req).read()
page = page.decode('utf-8')
# json_array = json.loads(page)
return page;
文档更新时间: 2023-12-01 10:14 作者:刘家帅