Description:
- Modify Asset information
API Version:
Version | Author | Date | Revision |
---|---|---|---|
2.0.0 | lenny | 2023-04-07 |
Request URL:
- http://icloud.assetscontrols.com:8092/OpenApi/Admin
- https://icloud.assetscontrols.com:3443/OpenApi/Admin
Request Method:
- POST
Request Header:
Parameter | Required | Type | Description |
---|---|---|---|
Content-Type | Yes | string | Request type: application/json |
Request Parameters:
Parameter | Required | Type | Description |
---|---|---|---|
FTokenID | Yes | string | Token ID |
FAction | Yes | string | Method name (UpdateAdminVehicle) |
FT_AdminVehicle | Yes | object | {“FGUID”: Vehicle unique identifier,”FVehicleName”:vehicle name,”FVIN”:vehicle identification number,”FEngineNumber”:engine number,”FVehicleTypeID”:vehicle type,”FInsuDate”:insurance date,”FPurchaseDate”:purchase date,”FDescription”:description,”FAgentGUID”:company’s unique identifier} |
Response Example:
Success:
{
"Result": 200,
"Message": "check token success",
"FObject": []
}
Error:
{
"Result": 102,
"Message": "Action is error",
"FObject": []
}
Response Parameter:
Parameter | Type | Description |
---|---|---|
Remarks:
- More return error codes are as follows:
- 104: Token error or expired
- 105: System exception
- 102: Request parameter error
- 107: There is an existing vehicle name
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 use objects to pass in
String body = "{FAction:\"UpdateAdminVehicle\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\",FT_AdminVehicle:\"{"FGUID": "5f2d6752-2ca7-4c4e-909f-7030cefbb72a","FVehicleName":"43564565343","FVIN":"","FEngineNumber":"","FVehicleTypeID":1,"FInsuDate":"2023-4-6 00:00:00","FPurchaseDate":"2023-4-6 00:00:00","FDescription":"4435","FAgentGUID":"661e7209-c77e-4a54-afb8-6d956f962bdf"}";
URL realUrl = new URL(url);
// Set the properties of the common 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");
// Must set the following two lines when sending a POST request
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 BufferedReader input stream to read URL response
BufferedReader bufReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
// Define BufferedReader input stream to read URL response
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 parameters, use json format and recommend using an object to pass it in
string body = "{FAction:\"UpdateAdminVehicle\",FTokenID:\"3acef045-d302-4032-b40a-d9ee6c1519cd\",FT_AdminVehicle:\"{"FGUID": "5f2d6752-2ca7-4c4e-909f-7030cefbb72a","FVehicleName":"43564565343","FVIN":"","FEngineNumber":"","FVehicleTypeID":1,"FInsuDate":"2023-4-6 00:00:00","FPurchaseDate":"2023-4-6 00:00:00","FDescription":"4435","FAgentGUID":"661e7209-c77e-4a54-afb8-6d956f962bdf"}\"}";
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': 'UpdateAdminVehicle',
'FTokenID': '3acef045-d302-4032-b40a-d9ee6c1519cd',
'FT_AdminVehicle': '{"FGUID": "5f2d6752-2ca7-4c4e-909f-7030cefbb72a","FVehicleName":"43564565343","FVIN":"","FEngineNumber":"","FVehicleTypeID":1,"FInsuDate":"2023-4-6 00:00:00","FPurchaseDate":"2023-4-6 00:00:00","FDescription":"4435","FAgentGUID":"661e7209-c77e-4a54-afb8-6d956f962bdf"}'
}
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 作者:Jeson