Batch Geocoder API Developer's Guide

Submitting a Batch Request

The Batch Geocoder API provides the resource jobs, which allows you to submit batch geocoding and reverse geocoding requests. Your initial submission must conform with the following Input Data guidelines. You can use the optional input fields to provide additional information to control how the job is run. The Batch Geocoder API handles the goecoding and reverse geocoding asynchronously. For more information on the lifecycle of a request, see Request Lifecycles and Jobs. For an example of how to request the results of a job, see Get Job Results.

To retrieve the output of a successful batch request, you must follow the steps below:

  1. Upload your data with a POST request to the resource jobs.
  2. Using the RequestId value contained in the response to your data upload request, check the status of the job with a GET request. You can only download the results when the job status is completed
  3. Using the RequestId value contained in the response to your data upload request, download the results by sending a GET request.

When you submit a request with wget or cURL, check the field names (for example &outCols=recId,…) and the field delimiter in the request for both the input and the output. wget and cURL return the response "400 Bad Request" if there is a issue or when the delimiter does not match the delimiter in the input file. Both wget and cURL need a content type to be specified in the header. Uploading compressed address data is currently not supported.

wget

For wget use the header
Content-Type: text/plain

Example of a geocoding request:

wget --header="Content-Type: text/plain; charset=UTF-8" --post-file=addresses.txt
    "https://batch.geocoder.cit.api.here.com
    /6.2/jobs?
    &app_code={YOUR_APP_CODE}
    &app_id={YOUR_APP_ID}
    &action=run
    &header=true
    &inDelim=;
    &outDelim=,
    &outCols=recId,latitude,longitude,locationLabel
    &mailto={YOUR_EMAIL}
    &outputcombined=true
    &language=de-DE"

Note that to submit a batch reverse geocoding request, the input file needs to contain a set of locations defined in terms of geocgraphic coordinates and the request must include the parameter mode set to retrieveAddresses:

wget --header="Content-Type: text/plain; charset=UTF-8" --post-file=locations.txt
    "https://batch.geocoder.cit.api.here.com
    /6.2/jobs?
    &app_code={YOUR_APP_CODE}
    &app_id={YOUR_APP_ID}
    &action=run
    &header=true
    &inDelim=;
    &outDelim=,
    &outCols=recId,latitude,longitude,locationLabel
    &mailto={YOUR_EMAIL}
    &outputcombined=true
    &language=de-DE
    &mode=retrieveAddresses"

cURL

If you use cURL, be sure to add the following header
Content-Type: text/plain
and submit the payload using the --data-binary parameter.

Example of a geocoding request:

curl -X POST -H "Content-Type: text/plain" --data-binary @addresses.txt
    "https://batch.geocoder.cit.api.here.com
    /6.2/jobs?
    &app_code={YOUR_APP_CODE}
    &app_id={YOUR_APP_ID}
    &action=run
    &header=true
    &inDelim=;
    &outDelim=,
    &outCols=recId,latitude,longitude,locationLabel
    &mailto={YOUR_EMAIL}
    &outputcombined=true
    &language=de-DE"

Note that to submit a batch reverse geocoding request, the input file needs to contain a set of locations defined in terms of geocgraphic coordinates and the request must include the parameter mode set to retrieveAddresses:

curl -X POST -H "Content-Type: text/plain" --data-binary @locations.txt
    "https://batch.geocoder.cit.api.here.com
    /6.2/jobs?
    &app_code={YOUR_APP_CODE}
    &app_id={YOUR_APP_ID}
    &action=run
    &header=true
    &inDelim=;
    &outDelim=,
    &outCols=recId,latitude,longitude,locationLabel
    &mailto={YOUR_EMAIL}
    &outputcombined=true
    &language=de-DE
    &mode=retrieveAddresses"