GET /api/v1/routing
Returns the gps path and eta of the stops. This also returns the list of stops that are not routed with a reason why it’s not routed.
Request parameters:
routeModelId
RouteModelId – (url) the route model Id returned from the POST endpoint
Sample code
using System;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
// Define the endpoint URL
string endpoint = "https://api.locate2u.com/api/v1/routing/{routeModelId}";
// Define the bearer token
string bearerToken = "YOUR_BEARER_TOKEN_HERE";
// Define the route model ID
string routeModelId = "YOUR_ROUTE_MODEL_ID_HERE";
// Concatenate route model ID with the endpoint
string requestUrl = endpoint.Replace("{routeModelId}", routeModelId);
// Create HttpClient instance
using (HttpClient client = new HttpClient())
{
// Add bearer token to the request headers
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", bearerToken);
// Send the GET request
HttpResponseMessage response = await client.GetAsync(requestUrl);
// Check if request was successful
if (response.IsSuccessStatusCode)
{
// Read and display the response content
string responseContent = await response.Content.ReadAsStringAsync();
Console.WriteLine($"Response Content: {responseContent}");
}
else
{
Console.WriteLine($"Request failed with status code {response.StatusCode}");
}
}
}
}
Response
Example Response :
Http 200
GetRoutingModelResponse Object
Sample:
{
"trips": [
{
"geometry": [
{
"latitude": -33.8743446,
"longitude": 151.2131667,
"altitude": 0
},
{
"latitude": -33.8743446,
"longitude": 151.2131667,
"altitude": 0
}
],
"stops": [
{
"stopRef": "12331A",
"stopEta": "2024-03-22T07:55:02.573Z"
}
],
"travelDistanceMetres": 120,
"travelTimeInSeconds": 3600,
"estimatedEndTime": "2024-03-22T07:55:02.573Z",
"publicUserId": "1231312UA"
}
],
"unplannedStops": [
{
"stopRef": "1231",
"reasons": [
"noVehiclesOrAllClosed"
]
}
]
}