PostTruckGPS
- This is a POST method, using this method a client can inform the AutoGuard Fleet System which Vehicle is currently loading the products.
Use Case
- Use to query to Post Truck GPS
Use an HTTP Post request to Post Truck GPS:
[POST] https://secure.autoguardtracking.com/WebApi/api/v2.0/PostTruckGPS
Request Header
The request header should contain the API Token obtained from the authentication process. Get Access Token.
Header Name | Description |
---|---|
Authorization | API Token obtained from the 1st step's authentication process. |
Request Parameters
The Request should contain the following parameters:
Parameter Name | Description | Value Format | Example |
---|---|---|---|
JSON OBJECT | JSON data | string | "22643GT" |
Create PostTruckGPS Object
Below is the PostTruckGPS POST request examples:
var client = new HttpClient();
var values = new Dictionary
{
{ "PostJSONData", " " },
};
client.DefaultRequestHeaders.Add("Authorization","Bearer YOUR_API_TOKEN")
var content = new FormUrlEncodedContent(values);
var response = await client.PostAsync("https://secure.autoguardtracking.com/WebApi/api/v2.0/PostTruckGPS", content);
var responseString = await response.Content.ReadAsStringAsync();();
//responseString will contain the response in JSON format
$.ajax({
beforeSend: function(xhrObj){
xhrObj.setRequestHeader("Authorization","Bearer YOUR_API_TOKEN");
},
type: "POST",
url: "https://secure.autoguardtracking.com/WebApi/api/v2.0/PostTruckGPS",
dataType: "json",
data: {
PostJSONData: "",
},
success: function(data){
//data object will contain the result as a JSON object
}
});
Sample PostTruckGPS Object
$.ajax({
beforeSend: function(xhrObj){
xhrObj.setRequestHeader("Authorization","Bearer YOUR_API_TOKEN");
},
type: "POST",
url: "https://secure.autoguardtracking.com/WebApi/api/v2.0/PostTruckGPS",
dataType: "json",
data: {
PostJSONData: "",
},
success: function(data){
//data object will contain the result as a JSON object
}
});
Sample of Post JSON Data
[
{
"VehicleUniqID": "22643GT",
"Lat": 41.49297,
"Lon": -87.92036,
"GPSTime": "03/14/2016 10:52:51",
"Speed": "43",
"VehicleStatus": "Key On",
},
{
"VehicleUniqID": "22643GT",
"Lat": 41.49297,
"Lon": -87.92036,
"GPSTime": "03/14/2016 10:52:51",
"Speed": "43",
"VehicleStatus": "Key On",
},
.............
.............
.............
]
A successful request will return the following result:
{
"StatusCode": "200",
"Message": "Post Truck GPS Save successfully."
}
Test
Test your Post Truck GPS JSON object using your AccessToken by entering it below:
Clicking the test button will send a request to the AutoGuard API and display the result below.