Brief description:

  • Modify Fence

API Version:

Version number Developer Develop date Revision date
1.0.0 lenny 2022-09-22 2020-09-22

Request URL:

Request method:

  • POST

Request header:

parameter name Is it necessary Type Description
Content-Type Yes string Request Type: application/json

Request parameter:

parameter name Is it necessary Type Description
FTokenID Yes string Token ID
FAction Yes string Method name (UpdateGISFence)

|FT_GISFence |Yes | FT_GISFence | Fence information |

FT_GISFence Object Description:
parameter name Is it necessary Type Description
FGUID Yes string Fence unique identifier
FAgentGUID Yes string Company unique identifier
FName Yes string Fence name
FNumber No string Fence number
FRemark No string Fence remark
FArea No double Area
FFormType No int Fence type (1: polygon; 2: circular)
FFenceTypeGUID No string Fence group unique identifier
FPath No string Fence longitude and latitude collection
FRadius No double Radius
FCenterLon No double Center point longitude
FCenterLat No double Center point latitude
FAddress No string Address

Return example:

Return when correct:

{
    "Result": 200,
    "Message":"success",
    "FObject": []
}

Return when error:

//FT_GISFence is null, indicating that the passed object is empty, and the data format should be incorrect
{
    "Result": 102,
    "Message": "FT_GISFence is null",
    "FObject": []
}

//Indicates an exception error
{
    "Result": 105,
    "Message": "fail",
    "FObject": []
}

//Indicates that the passed fence does not exist
{
    "Result": 107,
    "Message": "exists",
    "FObject": []
}

Note:

  • More return error codes are as follows:
  • 102: Request parameter error
  • 104: Token expired
  • 105: Indicates an exception error
  • 107: Indicates that the passed fence does not exist

Request example:

Java:

String result = "";
// Request path
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\": \"UpdateGISFence\",
    \"FT_GISFence\": {
        \"FGUID\": \"BB6999E9-8571-4D64-9C35-5D51C88F1133\",
        \"FName\": \"My Fence 3\",
        \"FNumber\": \"\",
        \"FRemark\": \"\",
        \"FArea\": 0,
        \"FFormType\": 1,
        \"FFenceTypeGUID\": \"\",
        \"FPath\": \"\",
        \"FRadius\": 0,
        \"FCenterLon\": 0,
        \"FCenterLat\": 0,
        \"FAddress\": \"\",
        \"FAgentGUID\": \"661E7209-C77E-4A54-AFB8-6D956F962BDF\"
    },
    \"FTokenID\": \"ec51d691-d9a7-4f74-95a8-1856be2ae745\",
    \"FTimeDifferent\": 28800,
    \"FLanguage\": \"1\"
}";
URL realUrl = new URL(url);
// Set common properties for requests
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 requires setting 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 a BufferedReader input stream to read the URL response
BufferedReader bufReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));  
// Read the response from the URL using a BufferedReader input stream
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 Body, JSON format. It is recommended to pass in an object.
string body = "{
    \"FAction\": \"UpdateGISFence\",
    \"FT_GISFence\": {
        \"FGUID\": \"BB6999E9-8571-4D64-9C35-5D51C88F1133\",
        \"FName\": \"My fence 3\",
        \"FNumber\": \"\",
        \"FRemark\": \"\",
        \"FArea\": 0,
        \"FFormType\": 1,
        \"FFenceTypeGUID\": \"\",
        \"FPath\": \"\",
        \"FRadius\": 0,
        \"FCenterLon\": 0,
        \"FCenterLat\": 0,
        \"FAddress\": \"\",
        \"FAgentGUID\": \"661E7209-C77E-4A54-AFB8-6D956F962BDF\"
    },
    \"FTokenID\": \"ec51d691-d9a7-4f74-95a8-1856be2ae745\",
    \"FTimeDifferent\": 28800,
    \"FLanguage\": \"1\"
}"; 
Encoding encoding = Encoding.UTF8;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
// Request method can be 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))
{
    // Return the JSON string
    return reader.ReadToEnd();
}

Python:

url = 'http://cloud.assetscontrols.com:8092/OpenApi/Admin'
data = {
    'FAction': 'UpdateGISFence',
    'FT_GISFence': {
        'FGUID': 'BB6999E9-8571-4D64-9C35-5D51C88F1133',
        'FName': 'My fence 3',
        'FNumber': '',
        'FRemark': '',
        'FArea': 0,
        'FFormType': 1,
        'FFenceTypeGUID': '',
        'FPath': '',
        'FRadius': 0,
        'FCenterLon': 0,
        'FCenterLat': 0,
        'FAddress': '',
        'FAgentGUID': '661E7209-C77E-4A54-AFB8-6D956F962BDF'
    },
    '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()
page = page.decode('utf-8')
# json_array = json.loads(page)
return page;
文档更新时间: 2023-12-01 10:16   作者:刘家帅