here-apihere-maps-restheremaps

here maps API for Batch Reverse Geocode Locations returns SuccessCount 0 on completed jobs everytime


What we are trying to achive

Get Geocoordinates for Multiple Addresses as per https://developer.here.com/documentation/batch-geocoder/dev_guide/topics/quick-start-batch-geocode.html

Environment

We are using the latest HERE Batch Geocoder API as of today (July 27 2021) https://developer.here.com/documentation/batch-geocoder/dev_guide/topics/api-reference.html

We are using the official Endpoint https://batch.geocoder.ls.hereapi.com/6.2/jobs/ and we are using apiKey, i.e. we are not using app_id/app_code as authentication method.

Our POST looks like this in our Postman project:

https://batch.geocoder.ls.hereapi.com/6.2/jobs?apiKey={{here-rest-api-key}}&indelim=%7C&outdelim=%7C&action=run&outcols=displayLatitude%2CdisplayLongitude%2Ccity%2Cstate%2Ccountry&outputcombined=true&maxresults=500&gen=8&header=true

Problem

Upon sending the Batch request, the API endpoint responds with SUCCESS (no credential errors):

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:SearchBatch xmlns:ns2="http://www.navteq.com/lbsp/Search-Batch/1">
    <Response>
        <MetaInfo>
            <RequestId>0FXztndLCKfpPFuOjGiGruNKcKXHIxpZ</RequestId>
        </MetaInfo>
        <Status>accepted</Status>
        <TotalCount>0</TotalCount>
        <ValidCount>0</ValidCount>
        <InvalidCount>0</InvalidCount>
        <ProcessedCount>0</ProcessedCount>
        <PendingCount>0</PendingCount>
        <SuccessCount>0</SuccessCount>
        <ErrorCount>0</ErrorCount>
    </Response>
</ns2:SearchBatch>

This is the POST request Body:

recId|searchText|country
0001|Invalidenstraße 116 10115 Berlin|DEU
0002|Am Kronberger Hang 8 65824 Schwalbach|DEU
0003|425 W Randolph St Chicago IL 60606|USA
0004|One Main Street Cambridge MA 02142|USA
0005|200 S Mathilda Ave Sunnyvale CA 94086|USA
0006|45492 Via Jaca Temecula CA|USA
0007|Marchant Pereira 1171 Providencia|CHL
0008|Los Alamos 1294 Santiago Centro|CHL
0009|Avenida Las Condes 12461 Las Condes|CHL
0010|Avenida Tulum 40 Cancun|MEX

After some seconds, Upon checking the Job Status, we get this result:

https://batch.geocoder.ls.hereapi.com/6.2/jobs/0FXztndLCKfpPFuOjGiGruNKcKXHIxpZ?action=status&apiKey={{here-rest-api-key}}

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ns2:SearchBatch xmlns:ns2="http://www.navteq.com/lbsp/Search-Batch/1">
    <Response>
        <MetaInfo>
            <RequestId>0FXztndLCKfpPFuOjGiGruNKcKXHIxpZ</RequestId>
        </MetaInfo>
        <Status>completed</Status>
        <JobStarted>2021-07-27T18:52:52.000Z</JobStarted>
        <JobFinished>2021-07-27T18:52:55.000Z</JobFinished>
        <TotalCount>10</TotalCount>
        <ValidCount>10</ValidCount>
        <InvalidCount>0</InvalidCount>
        <ProcessedCount>10</ProcessedCount>
        <PendingCount>0</PendingCount>
        <SuccessCount>0</SuccessCount>
        <ErrorCount>10</ErrorCount>
    </Response>
</ns2:SearchBatch>

Which means that our request was valid, it processed 10 records, the 10 records are valid, but... we still got 0 SuccessCount and 10 ErroCount (no item was succesfully reverse geocoded).

When we Get Job Result https://batch.geocoder.ls.hereapi.com/6.2/jobs/{{here-id-job}}/result?apiKey={{here-rest-api-key}} we get the results with empty fields:

recId|SeqNumber|seqLength|displayLatitude|displayLongitude|city|state|country
0001|0|0|||||DEU
0002|0|0|||||DEU
0003|0|0|||||USA
0004|0|0|||||USA
0005|0|0|||||USA
0006|0|0|||||USA
0007|0|0|||||CHL
0008|0|0|||||CHL
0009|0|0|||||CHL
0010|0|0|||||MEX

I've tried different Body requests, and in every scenario I get 100% ValidCount but 100% ErrorCount.

As per their pricing, Batch Requests are supported in Free Accounts. https://developer.here.com/pricing?planId=Freemium-Basic&fromFree=true&period=monthly#plan-details

Anybody has had this issue? Where are we missing something?


Solution

  • For those who might have the same issue, we solved the problem by using a different Field delimiter in the input data (indelim).

    All examples and Guide on HERE for Batch use | (pipe, URL encoded: %7C) but one of our devs pointed out that pipe usually means trouble in API data exchanges.

    So we changed indelim to %3B (we also changed the outdelim to %3B for consistency), so this is what our POST URL looked like:

    https://batch.geocoder.ls.hereapi.com/6.2/jobs?apiKey={{here-rest-api-key}}&indelim=%3B&outdelim=%3B&action=run&outcols=displayLatitude%2CdisplayLongitude%2Ccity%2Cstate%2Ccountry&outputcombined=true&header=true
    

    And we changed the POST Body from:

    recId|searchText|country 
    1|425 W Randolph St, Chicago Illinois 60606|USA 
    2|31 St James Ave Boston MA 02116|USA 
    3|10115 Berlin Invalidenstrasse 117|DEU
    

    to:

    recId;searchText;country 
    1;425 W Randolph St, Chicago Illinois 60606;USA 
    2;31 St James Ave Boston MA 02116;USA 
    3;10115 Berlin Invalidenstrasse 117;DEU
    ...
    

    And it worked like a charm!

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <ns2:SearchBatch xmlns:ns2="http://www.navteq.com/lbsp/Search-Batch/1">
        <Response>
            <MetaInfo>
                <RequestId>JOBID</RequestId>
            </MetaInfo>
            <Status>completed</Status>
            <JobStarted>2021-07-28T17:37:38.000Z</JobStarted>
            <JobFinished>2021-07-28T17:37:45.000Z</JobFinished>
            <TotalCount>428</TotalCount>
            <ValidCount>428</ValidCount>
            <InvalidCount>0</InvalidCount>
            <ProcessedCount>428</ProcessedCount>
            <PendingCount>0</PendingCount>
            <SuccessCount>428</SuccessCount>
            <ErrorCount>0</ErrorCount>
        </Response>
    </ns2:SearchBatch>
    

    Hope this helps to someone using the HERE Batch Geocoder API :).