Routing API v7 Developer's Guide

Requesting Matrix Calculation using POST method

In a POST body, you can only send start and destinations points in the same format as in the REST URL. However, this allows to send a larger amount of points than in the REST method, which has a length limitation for URLs. If you use wget, there are two ways of sending a POST body:
  • POST body from file (Note: Make sure there is no dot character '.' at the end of file in the hex editor to avoid an error response from the server)
  • POST body from string

The following example demonstrates a request of a matrix of routes for one start and two destinations points using a POST body from string and setting output filename with -O switch.

Note: These examples use a HERE API Key to authenticate your request. For the available authentication options, see the Identity & Access Management Developer Guide.
wget "https://matrix.route.ls.hereapi.com/routing/7.2/calculatematrix.json
?apiKey={YOUR_API_KEY}
&mode=fastest;pedestrian;traffic:disabled"
--post-data="start0=52.43%2C13.4&destination0=52.5%2C13.43&destination1=52.5%2C13.46"
-O output.json

The following example demonstrates a request of a matrix of routes for one start and two destinations points using POST body from file and setting output filename with -O switch.

wget "https://matrix.route.ls.hereapi.com/routing/7.2/calculatematrix.json
?apiKey={YOUR_API_KEY}
&mode=fastest;pedestrian;traffic:disabled"
--post-file=points.txt
-O output.json

Contents of file points.txt:

start0=52.43%2C13.4&destination0=52.5%2C13.43&destination1=52.5%2C13.46

Both examples result in the same response:

{
  response: {
  metaInfo: { /*content omitted*/ },
  matrixEntry: [
    {
    startIndex: 0,
    destinationIndex: 0,
    summary: { costFactor: 9462 }
    },
    {
    startIndex: 0,
    destinationIndex: 1,
    summary: { costFactor: 10600 }
    }
  ]
  }
}