Brief description:
- Batch delete fence.
API Version:
Version | Author | Date | Revised |
---|---|---|---|
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 Headers:
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 (UpdateGISFence ) |
FGUIDs | Yes | string | Unique identifier list of fence, multiple fence identifiers, separated by commas (e.g.:”BB6999E9-8571-4D64-9C35-5D51C88F1133,BB6999E9-8571-4D64-9C35-5D51C88F1133”) |
Response Example:
Successful Response:
{
"Result": 200,
"Message":"success",
"FObject": []
}
Error Response:
//Indicates error in the unique identifier of the fence passed in, probably due to wrong data format
{
"Result": 102,
"Message": "FGUIDs is null",
"FObject": []
}
//Indicates an exception/error occurred
{
"Result": 105,
"Message": "fail",
"FObject": []
}
//Indicates the fence passed in has a starting point set for the route
{
"Result": 125,
"Message": "Fence Name",
"FObject": []
}
//Indicates the fence passed in has an ending point set for the route
{
"Result": 126,
"Message": "Fence Name",
"FObject": []
}
//Indicates the fence passed in has waypoints set for the route
{
"Result": 127,
"Message": "Fence Name",
"FObject": []
}
//Indicates a vehicle is bound to the fence passed in
{
"Result": 124,
"Message": "Fence Name",
"FObject": []
}
Note:
- More error codes are as follows:
- 102: Request parameter error
- 104: Token expired
- 105: Indicates an exception/error occurred
- 124: Indicates a vehicle is bound to the fence passed in
- 125: Indicates the fence passed in has a starting point set for the route
- 126: Indicates the fence passed in has an ending point set for the route
- 127: Indicates the fence passed in has waypoints set for the route
Request Example:
Java:
String result = "";
//Request URL
String url = "http://cloud.assetscontrols.com:8092/OpenApi/Admin";
// Request parameters in JSON format, recommended to use object to pass in
String body = "{
\"FAction\": \"DeleteGISFences\",
\"FGUIDs\": \"BB6999E9-8571-4D64-9C35-5D51C88F1133\",
\"FTokenID\": \"ec51d691-d9a7-4f74-95a8-1856be2ae745\",
\"FTimeDifferent\": 28800,
\"FLanguage\": \"1\"
}";
URL realUrl = new URL(url);
// Set the 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");
// Send 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 the output stream cache
pw.flush();
// Define the BufferedReader input stream to read the URL response
BufferedReader bufReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
// Define the BufferedReader input stream to read the URL response
String line;
while ((line = bufReader.readLine()) != null) {
result += line;
}
// The return value is a JSON string
return result;
C#:
// Request URL
string url = "http://cloud.assetscontrols.com:8092/OpenApi/Admin";
// Request parameters in JSON format, recommended to use object to pass in
string body = "{
\"FAction\": \"DeleteGISFences\",
\"FGUIDs\": \"BB6999E9-8571-4D64-9C35-5D51C88F1133\",
\"FTokenID\": \"ec51d691-d9a7-4f74-95a8-1856be2ae745\",
\"FTimeDifferent\": 28800,
\"FLanguage\": \"1\"
}";
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 return value is a JSON string
return reader.ReadToEnd();
}
Python:
import urllib.request as request
from urllib import parse
url = 'http://cloud.assetscontrols.com:8092/OpenApi/Admin'
data ={
'FAction':'DeleteGISFences',
'FGUIDs': 'BB6999E9-8571-4D64-9C35-5D51C88F1133',
'FTokenID': 'ec51d691-d9a7-4f74-95a8-1856be2ae745',
'FTimeDifferent': 28800,
'FLanguage': '1'
}
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().decode('utf-8')
# The return value is a JSON string
return page
文档更新时间: 2023-12-01 10:16 作者:刘家帅