Building requests for the Distance Matrix API
Before you can start using the API, you will need to obtain the authentication token.
The following headers will be required, where the word token must be replaced by the token obtained in the authentication process:
--header 'Content-Type: application/json' \ --header 'Authorization: Bearer token'
All the parameters to solve the distance matrix calculation will be sent in body .
The Distance Matrix API works asynchronously. In other words, an ID will be returned when the problem is sent. With this ID you can check the response in the future or the processing status.
The API has the following endpoints, where the term {{matrixId}}
must be replaced by the ID of the problem to be consulted:
- https://api.maplink.global/matrix/v1/problems – POST
Used to send the logistics problem. An ID will be returned for the query. - https://api.maplink.global/matrix/v1/events?jobId={{matrixID}} – GET
Returns all the states from the time the request was received until its completion. - https://api.maplink.global/matrix/v1/jobs/{{matrixID}} – GET
Returns the current processing status of the request. - https://api.maplink.global/matrix/v1/solutions/{{matrixId}} – GET
Returns the result of the distance matrix.
Note: Solution IDs are available for consultation for a period of 7 days.