Brief description:

  • Delete device

API Version:

Version number Designer Date of design Date of revision
2.0.0 lenny 2023-04-07

Request URL:

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 (DeleteAdminAsset)
FGUIDs Yes string Device unique identifier, multiple devices separated by English comma

Return Example:

Return correctly:

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

Return incorrectly:

{
    "Result": 102,
    "Message": "Action is error",
    "FObject": []
}

Return Parameter Description:

Parameter name Type Explanation

Remarks:

  • More return error codes are as follows:
  • 104: Token error or expired
  • 105: System anomaly
  • 102: Request parameter error

Request Example:

Java:

String result = "";
// Request URL
String url = "http://cloud.assetscontrols.com:8092/OpenApi/Admin";  
// Request parameters, in JSON format, it is recommended to use objects to pass in.
String body = "{FAction:\"DeleteAdminAsset\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\",FGUIDs:\"5f2d6752-2ca7-4c4e-909f-7030cefbb72a,5f2d6752-2ca7-4c4e-909f-7030cefbb72a\"}";  
URL realUrl = new URL(url);
// Set the properties of the 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());
// Sending request parameters
pw.print(body);
// Flush the 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 URL response using a BufferedReader input stream
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, it is recommended to use objects to pass in.
string body = "{FAction:\"DeleteAdminAsset\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\",FGUIDs:\"5f2d6752-2ca7-4c4e-909f-7030cefbb72a,5f2d6752-2ca7-4c4e-909f-7030cefbb72a\"}"; 
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:

url = 'http://cloud.assetscontrols.com:8092/OpenApi/Admin'
data = {
      'FAction': 'DeleteAdminAsset',
      'FTokenID': '3acef045-d302-4032-b40a-d9ee6c1519cd',
      'FGUIDs': '5f2d6752-2ca7-4c4e-909f-7030cefbb72a,5f2d6752-2ca7-4c4e-909f-7030cefbb72a'
       }
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:15   作者:刘家帅