Description:

  • Save / Store Booking Information

Version:

Ver. Maker Established Date Revision Date
1.0.0 lenny 2021-12-31

Request URL:

Request Method:

  • POST

Request Header:

Parameter Name Whether Must Type Instructions
Content-Type Yes string Request Type: application/json

Request Parameter:

Parameter Name Whether Must Type Instructions
Origin Yes string the route of origin
Destination Yes string the route of destination
ContainerNo Yes string container No.
Type Yes Int 1:A 2:S
FTokenID Yes string Token

Return Example:

Return when correct:

{
    "Result": 200,
    "Message": "success",
    "FObject": [
        {
            "TripID": "BOC-A-12312021-0001"
        }
    ]
}

Return on error:

{
    "Result": 105,
    "Message": "Fail:param is null",
    "FObject": null
}

{
    "Result": 105,
    "Message": "Fail:no return data",
    "FObject": null
}


{
    "Result": 105,
    "Message": "Fail:without this route",
    "FObject": null
}

{
    "Result": 105,
    "Message": "Fail:other error",
    "FObject": null
}

{
    "Result": 105,
    "Message": "Fail:token error or timeout",
    "FObject": null
}

Return Parameter Description:

Parameter Name Type Instructions
TripID String Trip ID

Request Example:

String result = "";
//request url
String url ="http://icloud.assetscontrols.com::8092/api/AscentPH/SaveBookingInformation";
//request paramter,jsonString
String jsonParam ="{Origin:"abc",Destination:"bcd",ContainerNo:"0169",Type:1,Type:''}";
// httpPost request
HttpPost httpPost = new HttpPost(url);
 // Add configuration information
 httpPost.setConfig(config);
 httpPost.setHeader("Content-Type", "application/json");
 if(jsonParam.length()>0){
    httpPost.setEntity(new StringEntity(jsonParam,            ContentType.create("application/json", "utf-8")));
    HttpResponse response = httpClient.execute(httpPost);
 if (response != null && response.getStatusLine().getStatusCode() == 200) {
     result = EntityUtils.toString(response.getEntity());
     }
   }
 return result;

C#:

///request url
string url = "http://icloud.assetscontrols.com::8092/api/AscentPH/SaveBookingInformation";  
//request paramter ,jsonString
string body = "{Origin:"abc",Destination:"bcd",ContainerNo:"0169",FTokenID:'DB7F20D9-84C3-44C3-B05A-06A9C392A189'}"; 
Encoding encoding = Encoding.UTF8;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
 //request type 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))
{
    //return jsonString
    return reader.ReadToEnd();
}

Python:

url = 'http://icloud.assetscontrols.com::8092/api/AscentPH/SaveBookingInformation'
      data = {
      'Origin': 'abc''Destination': 'bcd''ContainerNo':'0186''Type':1'FTokenID':'DB7F20D9-84C3-44C3-B05A-06A9C392A189'
       }
      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;

Node.js:

文档更新时间: 2023-02-06 16:05   作者:刘家帅