- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 03:34 AM
Hi Community,
Can you please suggest me the method to pass the basic auth crds dynamically i have list of basic crds on basic auth configuration table eg for basic auth profile name like test, abc xyz
I need to pass whenever i am passing the parameter(i.e r.setStringParameterNoEscape('url', 'test');) here parameter is test so i need to use that basic auth profile name for auth i.e test need to pass
r = new sn_ws.RESTMessageV2('Vcenter API', 'Getting Session ID');
r.setStringParameterNoEscape('url', 'test');
r.setMIDServer('MY_MID_SERVER');
response = r.execute();
responseBody = response.getBody();
This required in my workflow
Thanks,
Benji
Solved! Go to Solution.
- Labels:
-
Service Mapping

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 06:21 AM
Hi,
Use the 'setAuthenticationProfile' method in RESTMessageV2 API.
Refer the RestMessageV2 doc
https://developer.servicenow.com/dev.do#!/reference/api/rome/server/c_RESTMessageV2API#r_RMV2-setAuthenticationProfile_S_S-anchor
It will look like this
sm = new sn_ws.RESTMessageV2("<REST_message_record>", "get");
//set auth profile to an basic auth profile record.
sm.setAuthenticationProfile('basic', '1234adsf123212131123qasdsf');

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 04:47 AM
Can you let me know the Problem Statement which you want to achieve before going into Technical Solution Details?
I mean what is the use case requirement here?
Regards
RP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 05:25 AM
I am trying to provision the VM in the vcenter from the service catalog which required vcenter session ID to login . In order to login to get the session id vcenter url which will get from vmware vcenter from the selected its crds which this need to pass in rest message from the selected mid server and selected crds to active this
Thanks,
Ben

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2022 06:21 AM
Hi,
Use the 'setAuthenticationProfile' method in RESTMessageV2 API.
Refer the RestMessageV2 doc
https://developer.servicenow.com/dev.do#!/reference/api/rome/server/c_RESTMessageV2API#r_RMV2-setAuthenticationProfile_S_S-anchor
It will look like this
sm = new sn_ws.RESTMessageV2("<REST_message_record>", "get");
//set auth profile to an basic auth profile record.
sm.setAuthenticationProfile('basic', '1234adsf123212131123qasdsf');