GuidesAPI Reference
Guides

Use lookup with HERE Batch API v7

The user wants to lookup a set addresses corresponding to their HERE ID.

📘

Note

Every place or location object known by HERE has a unique location identifier (HERE ID) that can be used to look up the place.

Request

The POST request, below includes the serviceHrn 'hrn:here:service::olp-here:search-lookup-7' (URL-encoded: serviceHrn=hrn%3Ahere%3Aservice%3A%3Aolp-here%3Asearch-lookup-7) that indicates the request is for lookup.

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-lookup-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|id
001|here:af:streetsection:tVuvjJYhO86yd5jk1cmzNB:CgcIBCCE59BeEAEaAzExNg
002|here:af:streetsection:6cjWtEIO2t07E.pKRVV5bA:CgcIBCCa46pZEAEaATgiCEhpbGxzaXRl
003|here:af:streetsection:hdZ6xBRUraY46IQZCqZidD:CgcIBCDMlOElEAEaAzQyNQ
004|here:af:streetsection:k-3ojKsslOuU0B1PF4J4HD:CgcIBCCq3cJGEAEaATE
005|here:af:streetsection:otB53KK-9vZXGNGL.uhpFD:CgcIBCD3n4EPEAEaAzIwMA

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-lookup-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|id
001|here:af:streetsection:tVuvjJYhO86yd5jk1cmzNB:CgcIBCCE59BeEAEaAzExNg
002|here:af:streetsection:6cjWtEIO2t07E.pKRVV5bA:CgcIBCCa46pZEAEaATgiCEhpbGxzaXRl
003|here:af:streetsection:hdZ6xBRUraY46IQZCqZidD:CgcIBCDMlOElEAEaAzQyNQ
004|here:af:streetsection:k-3ojKsslOuU0B1PF4J4HD:CgcIBCCq3cJGEAEaATE
005|here:af:streetsection:otB53KK-9vZXGNGL.uhpFD:CgcIBCD3n4EPEAEaAzIwMA')
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-lookup-7",
    "billingTags": [],
    "status": "queued",
    "href": "https://batch.search.hereapi.com/v7/batch/jobs/<jobId>"
}

bash output:

$ echo $resp | jq
{
    "id": "<jobId>",
    "serviceHrn": "hrn:here:service::olp-here:search-lookup-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:

001|52.53086|13.38469|Invalidenstraße 116, 10115 Berlin, Deutschland|116|Invalidenstraße|Mitte|Berlin|10115|Berlin|Berlin|DEU
002|50.16193|8.53361|Am Kronberger Hang 8, Hillsite, 65824 Schwalbach am Taunus, Deutschland|8|Am Kronberger Hang|Schwalbach am Taunus|Schwalbach am Taunus|65824|Main-Taunus-Kreis|Hessen|DEU
003|41.88432|-87.63877|425 W Randolph St, Chicago, IL 60606-1515, United States|425|W Randolph St|West Loop|Chicago|60606-1515|Cook|Illinois|USA
004|42.36225|-71.0803|1 Main St, Cambridge, MA 02142-1517, United States|1|Main St|East Cambridge|Cambridge|02142-1517|Middlesex|Massachusetts|USA
005|37.37634|-122.03405|200 S Mathilda Ave, Sunnyvale, CA 94086-6135, United States|200|S Mathilda Ave|Heritage District|Sunnyvale|94086-6135|Santa Clara|California|USA

Related information