cancel
Showing results for 
Search instead for 
Did you mean: 

Error while consuming Rest API 'the startDate should be a valid date with format "

amo_ry
Explorer
0 Kudos

Hi , 

I am trying to consume Rest API from ABAP Program  and it works but when passing a parameter 'startDate' in the url 

It returns with status 400 "bad request" and the message is : "the startDate should be a valid date with format YYYY-MM-DDTHH:mm:ss"

My url like this :

'https://test-ex-api.xx/test/internal/v1/accounts/statements?startDate=2023-05-01T12:43:40' . 

but it works fine in postman with the same format date  .  

can any one help me ? 

code.jpg

 

 

Accepted Solutions (0)

Answers (1)

Answers (1)

Ryan-Crosby
Active Contributor
0 Kudos

The URL should be escaped so replace the : character with %3A and try again.

 

Regards,

Ryan Crosby

amo_ry
Explorer
0 Kudos
Hi ryan , i replaced ':' with '%3A' in the date it returns the same message also i replaced ':' in the whole URL but it did not create the client and raised argument not found from 'create_by_url'
Ryan-Crosby
Active Contributor
0 Kudos
@amo_ry in the entire URL? You would only change it in the parameters of the URL.
amo_ry
Explorer
0 Kudos

@Ryan-Crosbyi changed it in the parameters only and it did not work

amo_ry_0-1709930539252.png

 

Ryan-Crosby
Active Contributor
0 Kudos
@amo_ry if neither the straight URL works nor with encoding the URL, then I would reach out to the API provider to see what they can see from their end or trace the activity in your SAP system to find clues.
amo_ry
Explorer
0 Kudos
@Ryan-Crosby thanks for your time , i will .
amo_ry
Explorer
0 Kudos

HI @Ryan-Crosby , they recieve the date like this : 

startDate : locations":["query"],"values":["2023-05-01T12%3a43%3a40"]

i think the parameter is escaped directly without escaping it . 

can we unescaping it ? 

 

 

Ryan-Crosby
Active Contributor
0 Kudos
@amo_ry and how does that compare to when you send via Postman? Something is triggering a bad request on their end, so the key is to discern the difference and then use that information to adjust your approach accordingly.