- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2022 07:25 PM
Hello,
When I request service catalog items via GET /sn_sc/servicecatalog/items, I get only 10 items and they do not always seem consistent. I am not getting the same 10 items every time I make the request. This is much less than the number of items I am able to view through the ui for my instance when navigating to 'Service Catalog' in 'Self-Service.'
I have already checked any issues with pagination and determined that this is not due oversight with the offset or page limit params. I am using the same credentials for the API request and for accessing the ui, so it is not a content access issue.
What could cause this discrepancy in the items returned by the API and the items I am seeing by accessing my instance through the ui?
Solved! Go to Solution.
- Labels:
-
Personal Developer Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2022 12:20 AM
Hi,
When I check the Service Catalog API on my instance (via System Web Services => Scripted Web Services => Scripted REST APIs) I see that the 'List of Catalog Items' (/api/sn_sc/v1/servicecatalog/items) API has sysparm_limit set to 10:
Can you check the same? You may need to update this.
Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2022 12:20 AM
Hi,
When I check the Service Catalog API on my instance (via System Web Services => Scripted Web Services => Scripted REST APIs) I see that the 'List of Catalog Items' (/api/sn_sc/v1/servicecatalog/items) API has sysparm_limit set to 10:
Can you check the same? You may need to update this.
Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2022 06:27 AM
Thank you. When attempting to modify this field, it says "Security prevents writing to this field." How can this value be modified?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2022 06:40 AM
Hi,
Click on the sysparm_limit link on that row and you can edit the value on that form view. You'll also need to make sure you're in the Service Catalog REST API application (and not Global).
Geoff

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2022 02:49 AM
Hi Joe,
Even though this question has been resolved, a suggestion.
Increasing the number of records that can be fetched by a single GET call may affect performance of an instance. Instead of increasing the sysparm_limit, it is recommended to also use sysparm_offset to loop and page through the records.
sysparm_limit=50&sysparm_offset=0
Example: ServiceNow script
var user = '<servicenow username>';
var password = '<password>';
var sysparmLimit = 50; // number of records to fetch at once
var sysparmOffset = 0;
var instanceName = '<instance name>';
var status = 200;
var baseUrl = 'https://' + instanceName + '.service-now.com/api/sn_sc/servicecatalog/items?sysparm_limit=';
var resultArray = []; // an array containing all records
while (status == 200) {
var url = baseUrl + sysparmLimit + '&sysparm_offset=' + sysparmOffset;
var request = new sn_ws.RESTMessageV2();
request.setEndpoint(url);
request.setHttpMethod('GET');
request.setBasicAuth(user, password);
request.setRequestHeader("Accept", "application/json");
var response = request.execute();
status = response.getStatusCode();
if (status == 200) {
var json = JSON.parse(response.getBody());
var result = json.result;
resultArray.push.apply(resultArray, result);
}
sysparmOffset += sysparmLimit;
}
gs.info('total:' + resultArray.length);
gs.info(JSON.stringify(resultArray));