Description:

  • Get all device types

API Version:

Version number Author Establishment date Revision date
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 (QueryAdminAssetType)
FAgentGUID Yes string Company unique identifier

Return Example:

Successful return:

{
    "Result": 200,
    "Message": "check token success",
    "FObject": [
        {
            "FAssetTypeID": 1120,
            "FOfflineTime": 86400,
            "FAssetTypeName": "AnyTrack",
            "FSystemAssetTypeName": "AnyTrack",
            "FClassify": 6,
            "FGateway": "47.112.122.222",
            "FPort": 10120
        },
        {
            "FAssetTypeID": 1150,
            "FOfflineTime": 86400,
            "FAssetTypeName": "AOVX-A/G",
            "FSystemAssetTypeName": "AOVX-A/G",
            "FClassify": 9,
            "FGateway": "47.112.122.222",
            "FPort": 6608
        }
    ]
}

Error return:

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

Return Parameters:

Parameter name Type Description
FAssetTypeID Int Device type
FOfflineTime String Device offline duration (in seconds)
FAssetTypeName String Device type name (customized)
FSystemAssetTypeName String Device type name
FClassify Int Device classification (1: electronic lock; 2: GP series; 3: departmental standard; 4: container monitoring series; 5: tire temperature and pressure series products; 6: other (can be used as basic positioning equipment); 7: Bluetooth lock; 8: lead seal lock; 9: Zuohuobao series; 10: mortar tank series)
FGateway String Gateway IP
FPort Int Gateway port

Remarks:

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

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 pass in objects
String body = "{FAction:\"QueryAdminAssetType\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\",FAgentGUID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\"}";  
URL realUrl = new URL(url);
// Set common properties of the 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");
// POST requests must be set as follows
conn.setDoOutput(true);
conn.setDoInput(true);
PrintWriter pw = new PrintWriter(conn.getOutputStream());
// Sending request parameters
pw.print(body);
// flush output buffer  
pw.flush();   
// Define BufferedReader to read the URL response
BufferedReader bufReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));  
// Define BufferedReader to read the URL response
String line;
while ((line = bufReader.readLine()) != null) {
     result += line;        
 }
// The returned value is a JSON string
return result;

C#:

// Request path
string url = "http://cloud.assetscontrols.com:8092/OpenApi/Admin";  
// Request parameters, JSON format parameters, it is recommended to pass in objects
string body = "{FAction:\"QueryAdminAssetType\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\",FAgentGUID:\"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': 'QueryAdminAssetType',
    'FTokenID': '3acef045-d302-4032-b40a-d9ee6c1519cd',
    'FAgentGUID': '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) '
                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   作者:刘家帅