Get a HERE account
If your organization has signed up for HERE Workspace or HERE Marketplace, contact your organization admin who can invite you to join the HERE platform organization established for your company. You can also request a free trial of the HERE platform if your company does not have an organization established for it. For more information, see the HERE platform pricing.
Create a project
- Sign in to the HERE platform using your HERE account.
- Open the Projects Manager from the launcher.
- Click Create new project.
- Enter a name for the project. Project names don't have to be unique.
- Enter a project ID. Project IDs must be unique within an organization and cannot be changed for the lifetime of the organization. Project IDs must be between 4 and 16 characters in length.
- Enter an optional description.
- Click Save.
Configure your project
- On the Resources tab, select Services and then click Link a Service.
- Search for Matrix Routing service(s) and click Link.
- Click Done.
- Select the Access and permissions tab and click Grant access.
- Under New app, select Create.
- Provide an app name and click Register. The platform creates a new app with a unique app ID.
- On the Credentials tab, select API Keys and then click Create API key to generate a maximum of two API Keys for your application authentication credentials. The API key is created and displayed.
Send a request
Before retrieving any traffic information, send the following XML body as an HTTP post request containing an HTTP
Content-Type header of
application/xml to the
<?xml version="1.0" encoding="UTF-8"?> <init-session> <tpeg format="TPEGBinary" messagesize="50000" sessionsize="1000" > <loc-ref id="TMC" version="1.3" /> <loc-ref id="ETL" version="1.0" /> <loc-ref id="OLR" version="1.0"/> <app id="TEC" version="3.2" /> <app id="TFP" version="1.0" expiration="17" /> </tpeg> <countries current="DE" destination="FR" /> <configuration> <att name="radius" value="10" /> <att name="expiration" value="600" /> <att name="timeout" value="300" /> <att name="frequency" value="180" /> </configuration> </init-session>
Authorizationheader with a
Bearertoken or query parameters. For the available authentication options, see the Identity & Access Management Developer Guide.
The XML response contains the URL and encryption key for traffic information requests. The following is an example response:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <init-session-response url="https://tpeg.cit.cc.api.here.com/tpeg/1.0/getmessages?v=5&cfg=1DpmhH-p7ElBonkVviVIDrPP3S.lVqIMc33pfUJ2luIDN58GPGDXo2zkQiizAnE-J-2W-MZbShEADKC6GFvLOO7pTnK41VTt3lRfk5cr7CFsMkXz97WRVx57LnljI-9d" key="99a8cd635aa563acaf0c486992d297ad"> <config name="fcd" value="enabled"/> </init-session-response>
Retrieve traffic information
After sending an
initsession request, send an HTTP post request with an HTTP header
application/octet-stream for traffic information to the URL in the response. The following example requests traffic information around a single point:
<?xml version="1.0" encoding="UTF-8" ?> <get-messages> <locations> <loc lat="52.55121" lon="13.16565"/> </locations> </get-messages>
- Compress the XML body using Gzip.
- Calculate the length in bytes of the Gzip file.
- Pre-append the length of the Gzip data to the compressed body as a little endian 32 bit integer.
- Pad the combination of Gzip content and length with zeros to make it evenly divisible by 16 bytes.
- Using AES 128, encrypt the resultant padded combination of content and length as follows:
- Create a random integer 16 bytes long.
- AES encrypt the result of step 4, in mode CBC using the integer generated in step 5.a as the initialization vector and the key from the
InitSessionresponse. Do not apply additional padding.
- Send the resulting block of AES encrypted data as an HTTP POST request, pre-appended by the integer generated in step 5.a as
content type application/octet-streamto the URL in the
- Extract the first 16 bytes of the response.
- Decrypt the remainder of the response with AES, using the session key from step 1.
- Extract the length of the Gzip content from the first four bytes of the decrypted data.
- Expand the Gzip content into TPEGBinary format.