LastLocation
- This method contains the Last Known Location of the vehicle with Date & Time
-
Returns one piece of information:
- Last Known Vehicle Location with the Location, Date & Time
Use Case
- Use to query latest Vehicle Location with Location, Date, Time
Use an HTTP GET request to obtain your vehicle's Last Location:
[GET] https://secure.autoguardtracking.com/WebApi/api/v2.0/LastLocation/{Vehicle_ID}?IsUtcTimeZone={IsUtcTimeZone}
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. |
URL Parameter
If you want to receive the Last Known Vehicle Location for a specific vehicle, the URL should contain the VehicleID parameter below.
Parameter Name | Description | Value Format | Example |
---|---|---|---|
Vehicle ID (Optional) | To get the Last Location of a specific vehicle. | numeric | 825 |
IsUtcTimeZone (optional) |
"True" returns Event Time in UTC "False"/"Blank" returns Event Time in Vehicle Time Zone |
true or false | true |
Create LastLocation Object
Below is the LastLocation request API examples:
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization","Bearer YOUR_API_TOKEN")
var response = await client.GetAsync("https://secure.autoguardtracking.com/WebApi/api/v2.0/LastLocation");
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: "GET",
url: "https://secure.autoguardtracking.com/WebApi/api/v2.0/LastLocation",
dataType: "json",
success: function(data){
//data object will contain the result as a JSON object
}
});
Sample LastLocation Object
$.ajax({
beforeSend: function(xhrObj){
xhrObj.setRequestHeader("Authorization","Bearer YOUR_API_TOKEN");
},
type: "GET",
url: "https://secure.autoguardtracking.com/WebApi/api/v2.0/LastLocation",
dataType: "json",
success: function(data){
//data object will contain the result as a JSON object
}
});
A successful request will return the following JSON result:
{
"StatusCode": "200",
"Message": "OK",
"Data":[
{
"VehicleId": 5835,
"VehicleName": "24/7--CalAmp-RACO-SIM-641",
"TimeZone": "CST",
"Lat": 41.49297,
"Lon": -87.92036,
"MoveTime": "03/14/2016 10:52:51",
"Address1": "Address Not Resolved",
"City": "",
"Division": "",
"Zip": ""
},
{
"VehicleId": 7920,
"VehicleName": "Samar-3843-T",
"TimeZone": "CST",
"Lat": 41.89565,
"Lon": -87.80007,
"MoveTime": "07/22/2018 14:31:34",
"Address1": "Address Not Resolved",
"City": "",
"Division": "",
"Zip": ""
},
{
"VehicleId": 8601,
"VehicleName": ".129--24/7-1x-KORE-CDMA--129DELPHIlistener",
"TimeZone": "CST",
"Lat": 37.35865,
"Lon": -79.23948,
"MoveTime": "07/23/2018 07:06:58",
"Address1": "Address Not Resolved",
"City": "",
"Division": "",
"Zip": ""
},
.............
.............
.............
]
}
Test
Test the LastLocation using your AccessToken by entering it below:
Clicking the test button will send a request to the AutoGuard API and display the result below.