Search code examples
amadeus

Amadeus Point of Interest Search INVALID_DATA_RECEIVED


Using the Amadeus Node SDK, Amadeus Points of Interest API only works for some geographical coordinates.

I am currently looking at some Points of Interest in France and everything north of Paris does not seem to work, and Amadeus responds with the error INVALID DATA RECEIVED.

Example of coordinates that work (Orleans, France):

Latitude: 47.90082
Longitude: 1.90283

Example of coordinates that don't work (Rouen, France):

Latitude: 49.443231 Longitude: 1.0999

Example error response:

{"response":{"contentType":"application/vnd.amadeus+json","statusCode":400,"request":{"host":"api.amadeus.com","port":443,"ssl":true,"scheme":"https","verb":"GET","path":"/v1/reference-data/locations/pois","params":{"latitude":49.443231,"longitude":1.0999,"radius":20},"queryPath":"/v1/reference-data/locations/pois?latitude=49.443231&longitude=1.0999&radius=20","bearerToken":"TOKEN","clientVersion":"4.0.0","languageVersion":"12.2.0","appId":null,"appVersion":null,"headers":{"User-Agent":"amadeus-node/4.0.0 node/12.2.0","Accept":"application/json, application/vnd.amadeus+json","Authorization":"Bearer TOKEN","Content-Type":"application/vnd.amadeus+json"}},"body":"{"errors":[{"status":400,"code":4926,"title":"INVALID DATA RECEIVED","detail":"","source":{"parameters":["longitude"]}}]}","result":{"errors":[{"status":400,"code":4926,"title":"INVALID DATA RECEIVED","detail":"","source":{"parameters":["longitude"]}}]},"parsed":true},"description":[{"status":400,"code":4926,"title":"INVALID DATA RECEIVED","detail":"","source":{"parameters":["longitude"]}}],"code":"ClientError"}"} 
var Amadeus = require('amadeus');

var amadeus = new Amadeus({
  clientId: 'PRODUCTION_ID',
  clientSecret: 'PRODUCTION_SECRET',
  hostname: 'production'
});

exports.autocompleteCreate = async (req, res) => {

    console.log(req.body);
    // I'm getting lat/lng from a POST request
    var latitude = parseFloat(JSON.stringify(req.body.latitude).toString().substring(0,9));
    var longitude = parseFloat(JSON.stringify(req.body.longitude).toString().substring(0,6));

    amadeus.referenceData.locations.pointsOfInterest.get({
        latitude: latitude,
        longitude: longitude,
        radius: 20
    }).then(
        function(response) {
            console.log(response)
        })
}


Solution

  • The issue was linked to the computation of the radius (for specific places). It has been fixed and delivered. You shouldn't face the problem anymore.