REST API integration Endpoint
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 12:06 AM
Hello all
How to automate servicenow with AD Manager plus using REST API.
we have Rest API in AD manager plus.
Requirement
1.We want to add users from servicenow to AD Mangaer plus assignment group.
2.Catalog item is approved users need to be add automatically on AD Mangaer plus assignment group.
Question.
1.How to get Endpoints ??
2.How connect by Authentication ??
Please support to achieve this
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 12:48 AM
Hi @akin9,
In order to generate the record on AD manager, the AD Manager needs to supply the post end point to call the REST post api. This will be an outbound rest in ServiceNow.
1.How to get Endpoints ?
- You need to create this on AD Manager.
2.How connect by Authentication ??
- You must set up this on AD Manager, and ServiceNow will require your client id and client secret in order to get a token from you.
Bullets 1 and 2 describe the manual procedure of integrating. But before making any custom implementation to call the AD manager by making a custom rest api, I advise exploring the existing ServiceNow app for ADmanager.
You may also refer on this documentation Integrate ADManager Plus with ServiceNow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 02:06 AM
Hello @Jerick I
Thank you for your Quick reply.
1.We are struggling to create end Points on AD ,Any format are there for End points.
Because i was tried http:<hostname>:8080/RestApI/Create user but its not working.
2.If we have endpoints ,
Questions
1.What are the steps need to follow for my req.
Eg.
Step1 -- Rest outbond message step2 ,step3 ,step4 ??
Please support to this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-28-2022 06:28 PM
Hi @akin9,
You need to create two outbound rest api.
Step 1: Outbound rest post for token
Step 2: On your token rest api provide the value of client id, client credential, source & client secret under content.
Step 3: Outbound rest post to push data and supply token.
Step 4: You can use the below sample code to call the two outbound rest using background script to try your implementation you need to provide JSON data structure and change some of the parameters base on you preference.
var token = new sn_ws.RESTMessageV2('Token', 'Post');
var response_token = token.execute();
var responseBody_token = response_token.getBody();
var httpStatus_token = response_token.getStatusCode();
responseBody_token = JSON.parse(responseBody_token);
var json = new global.JSON();
var data_final = JSON.stringify(data_obj);
data_final = data_final.replaceAll(':"null"', ':""');
json.encode(data_final);
var push_data = new sn_ws.RESTMessageV2('post data', 'Post');
push_data.setRequestHeader('Authorization', 'Bearer ' + responseBody_token.access_token);
push_data.setRequestBody(data_final);
var response_push = push_data.execute();
var responseBody = response_push.getBody();
var httpStatus = response_push.getStatusCode();
return httpStatus;