ATM Locator : Invalid input found, please correct the input data

Solved! Go to solution
developers_wbb
Dabbler

ATM Locator : Invalid input found, please correct the input data

Hi, i've been recently working with the ATM locator API and despite looking at all the API documentation i can't seem to send it data that it will accept. Please can someone help spot where i'm going wrong with this request?

 

The following is my code sample ( excluding any API keys etc ).

 

 

const postData = {
  wsRequestHeaderV2: {
    requestTs: "2019-05-02T13:01:56.000Z",
  },
  requestData: {
    culture: "en-US",
    distance: "20",
    distanceUnit: "mi",
    metaDataOptions: 0,
    location: {
      geocodes: {
        latitude: 40.443319,
        longitude: -79.999729,
      },
    },
    options: {
      range: {
        start: 10,
        count: 20,
      },
      sort: {
        primary: "city",
        direction: "asc",
      },
      useFirstAmbiguous: true,
    },
  },
};

function getApiToken(path, query_string, body, apiToken) {
  let timestamp = Math.floor(Date.now() / 1000);
  let message = timestamp + path + query_string + body;
  let digest = crypto
    .createHmac("SHA256", apiToken)
    .update(message)
    .digest("hex");
  let rtn = `xv2:${timestamp}:${digest}`;
  return rtn;
}

(async () => {
  let data = JSON.stringify(postData);
  let baseURL = "https://sandbox.api.visa.com/globalatmlocator";
  let apiURL = "v1/localatms/atmsinquiry";
  let uri = `${baseURL}/${apiURL}?apikey=${apiKey}`;
  let response = await req.post(
    {
      uri,
      headers: {
        "Content-Type": "application/json",
        Accept: "application/json",
        Authorization:
          "Basic " + Buffer.from(userId + ":" + password).toString("base64"),
        "X-PAY-TOKEN": getApiToken(apiURL, `apikey=${apiKey}`, data, apiToken),
      },
      body: data,
    },
    function (error, response, body) {
      console.log("resp  = ", body);
    }
  );
})();

 

 

Each time i try, i get the following... 
 

 

{"responseStatus":{"code":"9501","severity":"ERROR","message":"Invalid input found, please correct the input data","info":"","status":"400"}}

 

 

Where am i going wrong?

4 REPLIES 4
jenn_kh
Community Moderator

Re: ATM Locator : Invalid input found, please correct the input data

Thank you for reaching out, @developers_wbb! An agent is looking for a solution for you and will get back to you shortly. Until then, if any community members know a solution, please feel free to share it here. - Jenn

API_Managers
Visa Developer Support Specialist

Re: ATM Locator : Invalid input found, please correct the input data

Hi @developers_wbb,

 

I ran a sandbox test today using VDP Playground and received a successful request/response payload with 200 OK. Please see my sample request/response payload below. Please test again and share your results with us.

 

End Point https://sandbox.api.visa.com/globalatmlocator/v1/localatms/atmsinquiry
Method POST
Request
{
"wsRequestHeaderV2": {
"requestTs": "2019-12-12T08:16:12.000Z",
"requestMessageId": "ICE01-001",
"userBid": "10000108",
"correlationId": "909420141104053900000",
"applicationId": "VATMLOC",
"userId": "CDISIUserID"
},
"requestData": {
"distanceUnit": "km",
"distance": "20",
"culture": "en-US",
"options": {
"findFilters": [
{
"filterValue": "C",
"filterName": "OPER_HRS"
},
{
"filterValue": "N",
"filterName": "WHEELCHAIR"
}
],
"range": {
"start": 10,
"count": 20
},
"operationName": "string",
"sort": {
"primary": "city",
"direction": "asc"
}
},
"location": {"placeName": "Pittsburgh, PA"}
}
}
Response
{
"wsResponseHeaderV2": {
"totalNumberOfRecords": null,
"responseMessageId": "51VATMLOC6122020220301000948722",
"responseTs": 1646093389320,
"requestMessageId": "ICE01-001",
"correlationId": "909420141104053900000",
"numOfRowsReturned": 0
},
"wsStatus": {
"statusDesc": "Visa ATM Locator Svc-Failure (Empty Response Received from GMR)",
"statusCode": "CDIS203"
},
"wsResponseHeader": null,
"responseSummaryData": null,
"responseData": [{
"distanceUnit": null,
"metaData": null,
"totalATMCount": 0,
"foundATMLocations": null,
"bestMapView": null,
"properties": null,
"matchedLocations": [{"location": {
"geocodeMethod": null,
"score": 100,
"address": {
"country": "USA",
"formattedAddress": "Pittsburgh, Pennsylvania",
"city": "Pittsburgh",
"street": "",
"postalCode": "",
"street2": "",
"state": "Pennsylvania"
},
"coordinates": {
"latitude": 40.438510000000065,
"longitude": -79.99733999999995
},
"typeName": "Locality",
"placeName": "Pittsburgh, Pennsylvania",
"properties": null
}}]
}]
}
Response Header
Status Code: 200 OK
Server : nginx
Date : Tue, 01 Mar 2022 00:09:49 GMT
Content-Type : application/json
Content-Length : 913
Connection : keep-alive
X-SERVED-BY : -65f5b458s9
X-CORRELATION-ID : 1646093388_523_1185570030_-65f5b458s9_VDP_WS
X-Backside-Transport : OK OK,OK OK
X-Global-Transaction-ID : 18dcb9c4621d644c4fca816f
X-APP-STATUS : 200
Cache-Control : no-cache, no-store, must-revalidate
X-Frame-Options : SAMEORIGIN
X-XSS-Protection : 0
X-Content-Type-Options : nosniff
Strict-Transport-Security : max-age=31536000;includeSubdomains
Pragma : no-cache
Expires : -1
X-XSS-Protection : 1; mode=block
X-Content-Type-Options : nosniff
Strict-Transport-Security : max-age=31536000;includeSubdomains;always

 

 

You can use VDP Playground, Postman or SOAP UI tool to test the APIs. 

 

VDP Playground – https://community.developer.visa.com/t5/Developer-Tools/How-to-test-and-troubleshoot-APIs-with-the-V... 

 

Postman – https://developer.visa.com/pages/working-with-visa-apis/two-way-ssl#testing_twoway_ssl_connectivity_... 

 

SOAP UI – https://developer.visa.com/pages/working-with-visa-apis/two-way-ssl#testing_twoway_ssl_connectivity_...  

 

If the issue persists, please provide the following information:

1. Endpoint
2. Request Header
3. Request Body
4. Response Header (include the x-correlation-id)
5. Response Body

Using SoapUI, you can find the x-correlation-id in the Raw Tab of the response header.

 

You can also review our Visa Developer error codes and how to resolve them here - https://developer.visa.com/pages/visa-developer-error-codes  

 




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

API_Managers
Visa Developer Support Specialist

Re: ATM Locator : Invalid input found, please correct the input data

Hi @developers_wbb,

 

Is the issue fixed? Please confirm. 




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

API_Managers
Visa Developer Support Specialist

Re: ATM Locator : Invalid input found, please correct the input data

Hi @developers_wbb,

 

I haven't received an update from you, hence, I'll take you off my contact list. Feel free to reach out to the community if you need help or if you have questions. 




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.