24
Views
2
Comments
REST API Bad Request
Question

Hi,

I am consuming a REST API to fetch access tokens based on a code.
When I run the API via the browser I get a 400 Bad Request error. 

I am able to call the API successfully via Service Center (Test API) and PostMan. All input parameters seem to be perfectly fine when debugging. 

I have set my API logging to full but cannot find anything usefull here either. I see a lot of posts about this topic but unfortunately not one that solves my issue. 


The API has the following settings:

All input parameters used are send in the body:

On the overall API settings, the content-type has been set:



In the error log I can see that the HTTP trace content-lenght has information, and below that it also shows the entire request made (so all codes required etc). The only error I see is invalid request...


Anybody have any other ideas on how to resolve this?


Max

Hi,

"400 Bad Request error" This error will come when client site request was incomplete.

And this error means "The server detected a syntax error in the client's request"

You can check whatever you are passing it is in correct format or not.

Thanks

Ruchi

Since you are able to call the API correctly using the 'Test API' in service studio are you not using somewhere a site property with the wrong effective value somehow?
Also, can you share with us (if possible or remove sensitive info) the request done (HTTP trace) when calling the API?

You can enable some extra logging on the API: https://success.outsystems.com/documentation/11/extensibility_and_integration/set_the_logging_level_of_rest_and_soap_integrations/logging_levels_reference_for_integrations/

What are the variables you are using in your request (body)?
Maybe it has something to do with a specific date format which by default can work in Postman or Test query but not when running the API in runtime.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.