Authentication tab shows 'Send as me' option only in Rest API Explorer. If I want to send request with another user , I do not find any option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2022 11:42 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2022 12:05 AM
As the description already mentions if you want to test it with other user you can copy the code format from the below "code samples" of the rest api explorer. for servicenow script you can use the below and change the user and password variable as per your requirement.
var request = new sn_ws.RESTMessageV2();
request.setEndpoint('https://yourinstnace.service-now.com/api/now/table/<yourapi>?sysparm_limit=1');
request.setHttpMethod('GET');
//Eg. UserName="admin", Password="admin" for this code sample.
var user = 'admin';
var password = 'admin';
request.setBasicAuth(user,password);
request.setRequestHeader("Accept","application/json");
var response = request.execute();
gs.log(response.getBody());
Kindly mark helpful/correct if this resolved your query.
Regards
Vinayak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2022 09:21 PM
Hi Vinayak,
I am using REST API to submit a catalog request. I found that 'Service Catalog API' and 'Buy Item (POST)' resource is used to submit the request. So in order to send request using a different user, do I need to use the above script in the scripted rest resource of 'Buy Item'?
Please let me know.
Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2022 11:07 PM
You need to specify the parameter "sysparm_also_request_for" in the body of the api along with quantity.
Check documentation here Service Catalog API | ServiceNow Developers
Also there are some restrictions that you may have to look at.
Name | Description |
---|---|
sysparm_also_request_for | Comma-separated string of user sys_ids of other users for which to order the specified item. User sys_ids are located in the User [sys_user] table.
|
sysparm_quantity | Required. Quantity of the item. Cannot be a negative number.
Data type: Number |
variables | Name-value pairs of all mandatory cart item variables. Mandatory variables are defined on the associated form.
Data type: String |
Regards
Vinayak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2024 01:48 AM