How to do a - OAUTH2 POST REST Call?

4
Hello, I’m trying to call an API for Amadeus (Travel Booking API). However, this API uses OAUTH2 so I must get an access token first. To get the “access token” I believe I must first perform a POST REST call – is that assumption correct? The documentation states: and the response is:   I can get the POST call to work in POSTMAN: Can anyone tell me how I fill in the POST REST call microflow action to get the response with the access_token in it please?   Think I’m stuck here – filling in the request section: I’ve tried Custom templates to no avail :( using: -d"grant_type=client_credentials&client_id={1}&client_secret={2}" I’m not sure what needs to be filled in, would appreciate any help. Turning on trace I get the following:     Response content for POST request to https://test.api.amadeus.com/v1/security/oauth2/token HTTP/1.1 400 Bad Request Date: Tue, 10 Sep 2019 11:26:46 GMT Content-Type: application/json Content-Length: 217 Connection: keep-alive Ama-Gateway-Request-Id: rrt-06165da9c8359b509-a-de-14678-74674328-1 Access-Control-Allow-Origin: * Access-Control-Allow-Headers: origin, x-requested-with, accept, Content-Type Access-Control-Max-Age: 3628800 Access-Control-Allow-Methods: POST, GET, OPTIONS Server: Amadeus         {             "error":"invalid_request",             "error_description": "Mandatory grant_type form parameter missing",             "code": 38187,             "title": "Invalid parameters"         }          Cheers Adrian          
asked
5 answers
2

The documentation seems pretty clear: https://developers.amadeus.com/self-service/apis-docs/guides/authorization

You indeed do a POST request to gain your token. And with that access token you get you can retrieve the other services.

Regards,

Ronald

 

answered
1

This is described in the documentation, see https://docs.mendix.com/howto/integration/consume-a-rest-service

Hope reading this will help you.

answered
1

I had trouble getting an x-www-form-urlencoded request to work, but this post solved my problem.

answered
2

See Rom’s answer above. For those wanting to see if visually here is a screenshot:

answered
0

See above

answered