Error API Rest

Error API Rest

  
Hi

I'm currently working on an REST API integration, however, I can not seem to do this in OutSystems. The REST API call I make:

A post with the following structure:

header: content type: application / x-www-form-urlencoded;
body: grant_type: client_credentials;
Basic authentication completed (user and password).
I am having the following error

HTTP / 1.1 400 BadRequest
Content-Type: application / json; charset = UTF-8
Pragma: no-cache
Content-Length: 34
Cache-Control: no-cache
Date: Tue, 09 Oct 2018 16:41:50 GMT
Expires: -1
Server: Microsoft-IIS / 7.5
X-Powered-By: ASP.NET
{
  "error": "unsupported_grant_type"

}

Has anyone had this problem before?

Hi Daianne,

I notice in write application / x-www-form-urlencoded rather than application/x-www-form-urlencoded (no spaces before and after the /). Not sure if that causes an issue, i think it should be passed on the call all without spaces.

Are you sure you need grant_type: client_credentials and not grant_type: password ?

Did you try to test your API using a program like Postman, and if does, it give the same error as your OutSystems implementation, or does it then work?

Regards,

Daniel


 
Both Postman and OutSystems return the same error.

And did you try grant_type: password ?

If this is a rest API that you consume please check the documentation on how to use it and which grant_types are supported.

With the information you give it is not easy to understand why it shouldn't work.

Regards,

Daniel

Solution

Good night the problem was solved by passing the url in the form of a query String.

thank you


Solution