Re: report API - getting response 400 bad request invalid Parameter

dragonflycustom
Occasional Visitor

report API - getting response 400 bad request invalid Parameter

Hello,

 

I started working with the Visa API, I would like to use API for getting a list of payments for specific dates , I understand the API for that is the Report API.

when I run a GET query to sandbox from postman  I get "InvalidParameters"

 the URL I send is https://sandbox.api.visa.com/visadirect/reports/v1/transactiondata?startDate=2024-01-01&endDate=2024...

 

Authorization used is Basic Auth.

 

in the API reference there is no example to a AI query including the parameters :

https://developer.visa.com/capabilities/visa_direct/reference#tag/Reports-API/operation/TransactionD...

 

Thanks.

3 REPLIES 3
SyedSa
Community Moderator

Re: report API - getting response 400 bad request invalid Parameter

Hi @dragonflycustom, Thank you for reaching out. An agent will look into this and get back to you soon. Until then, if any community member knows a solution, feel free to reply in this thread. 

dragonflycustom
Occasional Visitor

Re: report API - getting response 400 bad request invalid Parameter

Hi,

 

Thank you, meanwhile I was able to change the date format in the query to this:

https://sandbox.api.visa.com/visadirect/reports/v1/transactiondata?fromDate=27102024&toDate=30102024

and now I am getting 'No data found'

 

I want to know what dates should I enter to get some data , in addition it seems the date range is limited to 5 days , just want to be sure the limitation exists only in the sandbox env and not in production.

 

 

 

API_Products
Visa Developer Support Specialist

Re: report API - getting response 400 bad request invalid Parameter

Hey @dragonflycustom,

 

To retrieve a list of payments for specific dates using the Visa Direct Reports API, you need to ensure that you are using the correct parameters and date format in your query. Here are the steps and considerations based on the Visa Developer documentation:

1. Endpoint URL and Parameters:
The correct endpoint for querying transaction data is:
```
https://sandbox.api.visa.com/visadirect/reports/v1/transactiondata
```
The parameters to be used are `fromDate` and `toDate`, and they need to be in the `yyyyMMdd` format.

2. Authorization:
Ensure that you are using Basic Auth with valid credentials.

3. Query Example:
Your query should look like this:
```
https://sandbox.api.visa.com/visadirect/reports/v1/transactiondata?fromDate=20240101&toDate=20240105
```

4. Date Range Limitation:
The date range in the sandbox environment is indeed limited to 5 days. This limitation is specific to the sandbox environment and does not apply to the production environment.

5. No Data Found:
If you receive a "No data found" response, it could be due to the lack of available transaction data for the specified date range in the sandbox environment. The sandbox environment may not have real transaction data for testing purposes.

6. Testing with Valid Dates:
To test with valid dates, you might want to try dates closer to the current date or dates that are known to have transaction data in the sandbox environment.

Here is a sample request URL with the correct date format and a 5-day range:
```
https://sandbox.api.visa.com/visadirect/reports/v1/transactiondata?fromDate=20240101&toDate=20240105
```




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.