Brief description:
- Query route plan information.
Interface version:
Version Number | Developer | Date of Development | Date of Revision |
---|---|---|---|
1.0.0 | lenny | 2022-09-22 | 2020-09-22 |
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 | Required | string | Request Type: application/json |
Request Parameters:
Parameter Name | Required | Type | Description |
---|---|---|---|
FTokenID | Required | string | Token ID |
FAction | Required | string | Method Name (QueryRoutePlanList ) |
Object Description:
Parameter Name | Required | Type | Description |
---|---|---|---|
FAgentGUID | String | Company unique identifier | |
FAgentName | String | Company Name | |
FRouteGUID | String | Route unique identifier | |
FRouteName | String | Route Name | |
FRouteCode | String | Route Code |
Return Example:
When correct, it returns:
{
"Result": 200,
"Message": "check token success",
"FObject": [
{
"FRouteGUID": "794270c9-c74c-40c6-8e3f-00754ff5a28f",
"FRouteName": "test",
"FRouteCode": "20231023163308",
"FAgentGUID": "661e7209-c77e-4a54-afb8-6d956f962bdf",
"FAgentName": "test"
},
{
"FRouteGUID": "8bcf571b-ea0a-4cc7-a674-0326d9b6887a",
"FRouteName": "test1",
"FRouteCode": "22222",
"FAgentGUID": "661e7209-c77e-4a54-afb8-6d956f962bdf",
"FAgentName": "test2"
}
]
}
}
Error returns:
// Indicates that the incoming object is empty, which should be due to incorrect data format
{
"Result": 102,
"Message": "FParma is null",
"FObject": null
}
//Indicates token expiration or error.
{
"Result": 104,
"Message": "token error or timeout",
"FObject": []
}
// Indicates that there is an exception error
{
"Result": 105,
"Message": "fail",
"FObject": null
}
Remarks:
- More error codes returned are as follows:
- 102: Request parameter error.
- 104: Token expired or error.
- 105: General error.
Request Example:
Java:
String result = "";
//Request URL
String url = "http://cloud.assetscontrols.com:8092/OpenApi/Admin";
//Request parameters, in JSON format, it is suggested to pass in an object
String body = "{FAction:\"QueryRoutePlanList\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\"}";
URL realUrl = new URL(url);
// Set general request properties
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");
// Must set the following two lines to send a POST request
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;
}
// The returned value is a JSON string
return result;
C#:
// Request URL
string url = "http://cloud.assetscontrols.com:8092/OpenApi/Admin";
// Request parameters, in JSON format, it is recommended to pass in an object
string body = "{FAction:\"QueryRoutePlanList\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\"}";
Encoding encoding = Encoding.UTF8;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
// Request method POST / 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 returned value is a JSON string
return reader.ReadToEnd();
}
Python:
url = 'http://cloud.assetscontrols.com:8092/OpenApi/Admin'
data = {
'FAction': 'QueryRoutePlanList',
'FTokenID': '3acef045-d302-4032-b40a-d9ee6c1519cd'
}
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) 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;
文档更新时间: 2024-12-24 14:16 作者:刘家帅