vmWare vRO & serviceNow APi's with OAUth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2022 06:35 AM
Hello the community,
This is my first post here and I'm a newbie on serviceNow.
We have build all our API's request in postman and now we try to automate all requests from Vmware vRealize Orchestrator.
We are stuck on the step to get an access token with OAuth.
1°) we build our BODY :
//create a fresh json object to store the data from the user
jsonContent = new Object();
jsonContent.grant_type = "password_credentials";
jsonContent.username = username;
jsonContent.password = password;
jsonContent.client_id = "4e88edc1992XXXXXXXXX38567";
jsonContent.client_secret = "2XXXXXXC";
//switch the format to string in order to be request-ready
content = JSON.stringify(jsonContent);
System.debug("Content of request : " + content);
2°) We launch the request to the URL : https://OURinstance.service-now.com/oauth_token.do
//prepare request
var inParamtersValues = [];
var request = restOperation.createRequest(inParamtersValues, content);
//set the request content type
request.contentType = "application/x-www-form-urlencoded";
System.debug("Request : " + request);
System.debug("Request URL : " + request.fullUrl);
//execute request
var response = request.execute();
//prepare output parameters
System.debug("Response : " + response);
statusCode = response.statusCode;
wsResponse = response.contentAsString;
System.debug("Raw answer : " + wsResponse);
var jsonWsResponse = JSON.parse(wsResponse);
Do you have try to get a Token from vRO please ?
Thx for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2023 06:32 AM - edited 05-03-2023 06:34 AM
Hello nobody use vmWare vRealize Orchestrator to request serviceNow api's?