GuidesAPI Reference
Guides

Use reverse geocoding with HERE Batch API v7

The user wants to request a set of addresses corresponding to a data set of locations.

Request

The POST request, below includes the serviceHrn 'hrn:here:service::olp-here:search-revgeocode-7' (URL-encoded: serviceHrn=hrn%3Ahere%3Aservice%3A%3Aolp-here%3Asearch-revgeocode-7) that indicates the request is for reverse geocoding. Also specify the HTTP-Header Content-Type=text/plain.

POST https://batch.search.hereapi.com/v7/batch/jobs
?apiKey={YOUR_API_KEY}
&serviceHrn=hrn%3Ahere%3Aservice%3A%3Aolp-here%3Asearch-revgeocode-7
&inputDelimiter=%7C
&outputDelimiter=%7C
&outputColumns=positionLat%7CpositionLng%7CaddressLabel%7CaddressHouseNumber%7CaddressStreet%7CaddressDistrict%7CaddressCity%7CaddressPostalCode%7CaddressCounty%7CaddressState%7CaddressCountryCode

The following POST body includes the locations:

recId|in
0001|52.505308,13.327739,250
0002|49.917257,8.486488,250
0003|51.119593,7.399356,250
0004|49.20012,8.12326,250
0005|51.116845,7.397318,250
0006|52.265938,7.976922,250
0007|48.143131,10.829233,250
0008|51.770237,7.442682,250
0009|51.511877,7.461382,250
0010|52.53,13.391389,250

With cURL and store jobId in environment. Variable YOUR_API_KEY has to be set:

resp=$(curl --request 'POST' \
  "https://batch.search.hereapi.com/v7/batch/jobs?serviceHrn=hrn%3Ahere%3Aservice%3A%3Aolp-here%3Asearch-revgeocode-7&inputDelimiter=%7C&outputDelimiter=%7C&outputColumns=positionLat%7CpositionLng%7CaddressLabel%7CaddressHouseNumber%7CaddressStreet%7CaddressDistrict%7CaddressCity%7CaddressPostalCode%7CaddressCounty%7CaddressState%7CaddressCountryCode&apiKey=${YOUR_API_KEY}" \
  --header 'accept: application/json' \
  --header 'Content-Type: text/plain' \
  --data 'recId|in
0001|52.505308,13.327739,250
0002|49.917257,8.486488,250
0003|51.119593,7.399356,250
0004|49.20012,8.12326,250
0005|51.116845,7.397318,250
0006|52.265938,7.976922,250
0007|48.143131,10.829233,250
0008|51.770237,7.442682,250
0009|51.511877,7.461382,250
0010|52.53,13.391389,250')
echo $resp | jq
jobId=$(echo $resp | jq -r '.id')
echo Job Id is: $jobId

Response

The response contains a jobId. Use this jobId for all actions you want to perform on this job.

{
    "id": "<jobId>",
    "serviceHrn": "hrn:here:service::olp-here:search-revgeocode-7",
    "billingTags": [],
    "status": "submitted",
    "href": "https://ols-batch-service-eu-west-1.api-gateway.sit.ls.hereapi.com/v7/batch/jobs/<jobId>"
}

bash output:

$ echo $resp | jq
{
  "id": "<jobId>",
  "serviceHrn": "hrn:here:service::olp-here:search-revgeocode-7",
  "billingTags": [],
  "status": "queued",
  "href": "https://batch.search.hereapi.com/v7/batch/jobs/<jobId>"
}
$ echo Job Id is: $jobId
Job Id is: <jobId>

After starting the job, you can request the status of the job. See Get job status.

As soon as the status of the job is 'success', you can download the result of the batch job. For an example of how to download the results, see Get job results.

Result

The result will like this:

recId|seqNumber|seqLength|positionLat|positionLng|addressLabel|addressHouseNumber|addressStreet|addressDistrict|addressCity|addressPostalCode|addressCounty|addressState|addressCountryCode
0001|1|1|52.50517|13.32803|Fasanenstraße 81A, 10623 Berlin, Deutschland|81A|Fasanenstraße|Charlottenburg|Berlin|10623|Berlin|Berlin|DEU
0002|1|1|49.9172|8.48666|Friedrichstraße 45, 64521 Groß-Gerau, Deutschland|45|Friedrichstraße|Groß-Gerau|Groß-Gerau|64521|Groß-Gerau|Hessen|DEU
0003|1|1|51.11961|7.39955|Gartenstraße 9, 51688 Wipperfürth, Deutschland|9|Gartenstraße|Wipperfürth|Wipperfürth|51688|Oberbergischer Kreis|Nordrhein-Westfalen|DEU
0004|1|1|49.20029|8.12324|Industriestraße 21, 76829 Landau in der Pfalz, Deutschland|21|Industriestraße|Landau in der Pfalz|Landau in der Pfalz|76829|Landau in der Pfalz|Rheinland-Pfalz|DEU
0005|1|1|51.11693|7.39724|Marktstraße 5, 51688 Wipperfürth, Deutschland|5|Marktstraße|Wipperfürth|Wipperfürth|51688|Oberbergischer Kreis|Nordrhein-Westfalen|DEU
0006|1|1|52.2659|7.97693|Rheiner Landstraße 195C, 49078 Osnabrück, Deutschland|195C|Rheiner Landstraße|Hellern|Osnabrück|49078|Osnabrück (Stadt)|Niedersachsen|DEU
0007|1|1|48.14307|10.82947|Elias-Holl-Straße 5, 86836 Obermeitingen, Deutschland|5|Elias-Holl-Straße||Obermeitingen|86836|Landsberg am Lech|Bayern|DEU
0008|1|1|51.77039|7.44276|Ladestation für Elektrofahrzeuge, Steverstraße 29, 59348 Lüdinghausen, Deutschland|29|Steverstraße|Lüdinghausen|Lüdinghausen|59348|Coesfeld|Nordrhein-Westfalen|DEU
0009|1|1|51.51217|7.46135|Kuhstraße 4, 44137 Dortmund, Deutschland|4|Kuhstraße|Mitte|Dortmund|44137|Dortmund|Nordrhein-Westfalen|DEU
0010|1|1|52.53001|13.3912|Tieckstraße 20, 10115 Berlin, Deutschland|20|Tieckstraße|Mitte|Berlin|10115|Berlin|Berlin|DEU

Related information