Description:
- Transferring Devices or Assets(Vehicle/Container) to another company
API Version:
Version number | Author | Establishment date | Revision date |
---|---|---|---|
2.0.0 | lenny | 2024-12-19 |
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 | Yes | string | Request type: application/json |
Request Parameters:
Parameter name | Required | Type | Description |
---|---|---|---|
FTokenID | Yes | string | Token ID |
FAction | Yes | string | Method name (TransferAssetByFGUIDs) |
FNewAgentGUID | Yes | string | Company unique identifier |
FGUIDs | Yes | string | Unique identifier of the Device or Asset, multiple identifiers are separated by commas. |
FSelectType | Yes | int | 0: transfer by Device 1: transfer by Asset; Default 0: transfer by Device |
FStatus | Yes | int | Whether to transfer the bound Asset or Device (1: transfer; 0: do not transfer) |
Return Example:
Successful return:
{
"Result": 200,
"Message": "succeed",
"FObject": []
}
Error return:
{
"Result": 102,
"Message": "Action is error",
"FObject": []
}
Return Parameters:
Parameter name | Type | Description |
---|
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":"TransferAssetByFGUIDs","FGUIDs":"08c75b42-e80a-41ef-9c38-0bc4fd28cbe1,d2204050-7314-491a-a77f-87bce7ee9593","FNewAgentGUID":"0d1cada4-430c-4823-ba96-5ab4913d4019","FStatus":0,"FSelectType":1,"FTokenID":"ec51d691-d9a7-4f74-95a8-1856be2ae741","FTimeDifferent":28800,"FLanguage":"1"}";
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":"TransferAssetByFGUIDs","FGUIDs":"08c75b42-e80a-41ef-9c38-0bc4fd28cbe1,d2204050-7314-491a-a77f-87bce7ee9593","FNewAgentGUID":"0d1cada4-430c-4823-ba96-5ab4913d4019","FStatus":0,"FSelectType":1,"FTokenID":"ec51d691-d9a7-4f74-95a8-1856be2ae741","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 returned value is a JSON string
return reader.ReadToEnd();
}
Python:
url = 'http://cloud.assetscontrols.com:8092/OpenApi/Admin'
data = {
'FAction': 'TransferAssetByFGUIDs',
'FTokenID': '3acef045-d302-4032-b40a-d9ee6c1519cd',
'FGUIDs':'08c75b42-e80a-41ef-9c38-0bc4fd28cbe1,d2204050-7314-491a-a77f-87bce7ee9593'
'FNewAgentGUID': '3acef045-d302-4032-b40a-d9ee6c1519cd',
'FStatus': 0,
'FSelectType': 0
}
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;
文档更新时间: 2024-12-19 17:01 作者:Jeson