Configure result limits per record
By default, HERE Batch API v7 sets the limit parameter to 1. To receive multiple results for a record, override this value.
You can override the limit per record by specifying a value in each line or by setting a default value (see Input data).
Request
The POST request below includes a limit column with a default value of 1. This is also the default, if the column is not present at all.
This setup allows you to override the value for recId 0003. Because limit is the last column, you can omit it for other records without inserting an empty cell.
POST https://batch.search.hereapi.com/v7/batch/jobs?serviceHrn=hrn%3Ahere%3Aservice%3A%3Aolp-here%3Asearch-geocode-7&apiKey=${YOUR_API_KEY}
accept: application/json
Content-Type: text/plain
recId|q|country|limit=1
0001|Invalidenstraße 116 10115 Berlin|DEU
0002|Am Kronberger Hang 8 65824 Schwalbach|DEU
0003|425 Randolph St Chicago IL 60606|USA|2
0004|One Main Street Cambridge MA 02142|USAWith 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-geocode-7&apiKey=${YOUR_API_KEY}" \
--header 'accept: application/json' \
--header 'Content-Type: text/plain' \
--data 'recId|q|country|limit=1
0001|Invalidenstraße 116 10115 Berlin|DEU
0002|Am Kronberger Hang 8 65824 Schwalbach|DEU
0003|425 Randolph St Chicago IL 60606|USA|2
0004|One Main Street Cambridge MA 02142|USA')
echo $resp | jq
jobId=$(echo $resp | jq -r '.id')
echo Job Id is: $jobIdResponse
Response and bash output is similar as described in Geocoding
Result
The result will like this:
recId|seqNumber|seqLength|position|address|title
0001|1|1|(52.53086,13.38469)|Invalidenstraße 116, 10115 Berlin, Deutschland|Invalidenstraße 116, 10115 Berlin, Deutschland
0002|1|1|(50.16193,8.53361)|Am Kronberger Hang 8, Hillsite, 65824 Schwalbach am Taunus, Deutschland|Am Kronberger Hang 8, Hillsite, 65824 Schwalbach am Taunus, Deutschland
0003|1|2|(41.88432,-87.63877)|425 W Randolph St, Chicago, IL 60606-1515, United States|425 W Randolph St, Chicago, IL 60606-1515, United States
0003|2|2|(41.88426,-87.6152)|425 E Randolph St, Chicago, IL 60601, United States|425 E Randolph St, Chicago, IL 60601, United States
0004|1|1|(42.36225,-71.0803)|1 Main St, Cambridge, MA 02142-1517, United States|1 Main St, Cambridge, MA 02142-1517, United StatesPlease note, that recId 0003 occurs two times. In both lines the third cell seqLength has value 2 which indicates two results.
The second cell seqNumber indices first and second result for this record.
Related information
Updated 29 days ago