- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2017 07:25 AM
Hi,
I have been stuck for a while to configure the HTTP method for Post using the Outbound REST Message.
Since the API will need me to send some information on the request body, such as: grant_type, resource, client_id, etc.
So, I made the configuration as below.
But when I tested it, it looks like the Azure endpoint cannot recognize the Content to get the parameter for the request body with this error:
"error":"invalid_request","error_description":"AADSTS90014: The request body must contain the following parameter: 'grant_type'.
I strongly believe this is because the problem on the Content-type, since I also got the same exact error when I am changing the Content-Type in another Content-type in Postman.
Just for the info, this API have been tested working correctly if I use the Postman standard content-type with form data.
Any suggestion or clue will much appreciated.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-18-2017 12:55 PM
I think you just need to remove the curly brackets from your body and change the content-type to 'application/x-www-form-urlencoded'.
Example, using only code (no Outbound REST Message forms)
var restMessage = new sn_ws.RESTMessageV2();
restMessage.setEndpoint('http://httpbin.org/post');
restMessage.setHttpMethod('post');
//restMessage.setMIDServer('midserverbyname');
restMessage.setRequestHeader('content-type','application/x-www-form-urlencoded');
restMessage.setRequestHeader('accept','application/json');
restMessage.setRequestBody('form1=value1&form2=value2');
var response = restMessage.execute();
var httpStatus = response.getStatusCode();
var responseBody = response.haveError() ? response.getErrorMessage() : response.getBody();
if (httpStatus == '200'){
gs.info('Body: '+responseBody);
}else{
gs.info('HTTP Status: '+httpStatus);
gs.info('Error: '+responseBody);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2018 03:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-02-2018 04:25 AM
Thanks Mirza, let me try with this.
Also, my requirement is to Send the server details [like org, legal entity details) per resource group back to Azure.
Since i am new using this REST, can you tell me which method would be good "POST" or "PUT" should i be using to send the details to the Azure per resource group?
Also, for testing connection do i need to set up the Bearer token as well or is it not required.
Thanks a lot in advance for your response.
@mirza
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2018 11:03 PM
Hi Renuka,
It should be depend on what API that Azure provides. I assume you're working with Azure Resource Manager, you can find out the list of available API in this link: https://docs.microsoft.com/en-us/rest/api/resources/, and choose the most suitable action that you need.
Regards,
Mirza
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2018 10:34 PM
Hi Mirza,
I have made the changes as per your screenshot, but i still get only the status code as 200 and dont get any response.
Can you please guide me here.
@mirza
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2018 10:56 PM
Hi Renuka,
What REST API you're using? In this thread I were using the API to get the bearer token from Azure. And then, I can use the token to interact with other Azure APIs.
Regards,
Mirza