$skip OData query parameter not working

Brad Warman
Giga Sage

Hi everyone. I am attempting to paginate a REST GET call to SAP due to a hard coded restriction of the number of items returned in a payload. I can successfully use the OData $top query parameter to reduce the number of items returned if required, but whenever I add $skip to assist in pagination, the request always fails. I've tried using $skip in conjunction with $top as well as on it's own, in both scripted REST calls and in a flow, but every time it's added, the request fails.

 

Any ideas on what could be causing this? Using $skip in postman hitting the same endpoint works as expected.

 

Cheers,

 

Brad

1 ACCEPTED SOLUTION

Hi @palanikumar. Yeah it works perfectly in Postman. Given the critical nature of the request, I ended up just splitting the call into two parts - one for active records and one for inactive. It took a lot of trial and error but I eventually found a way to use $filter in a way that ServiceNow allowed. This gets us well under the hard coded 5000 record limit on both calls and allows us to obtain all the data we need.

 

There seemed to be a few OData queries that just wouldn't work when sending from ServiceNow, $skip being one of those. Interestingly, $count is also not working.

 

Thanks for your help with this though.

View solution in original post

6 REPLIES 6

palanikumar
Giga Sage

Hi,

What is the error message. Make sure the URL doesn't have any special characters those are not supported in ServiceNow

Thank you,
Palani

Hi @palanikumar. The HTTP status code being returned is 403, but the response body doesn't indicate that it is a permissions issue. The response body just contains a generic HTML error page with no further details. Seeing the 403, I assumed permission issues, but I am able to successfully process the same request without the $skip in ServiceNow using the same credentials/OAuth token. I can also successfully get a response using the $skip in postman using the same credentials.

 

The HTTP log shows the URL as being ok with no illegal characters too.

Hi @Brad Warman ,

Check if there is any firewall blocking it.

or maybe something is blocking the request form reaching the server

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Hi @Chaitanya ILCR. Thanks for your response.

 

I ended up just splitting the call into two parts - one for active records and one for inactive using $filter. This gets us the data in two parts, both under the 5000 limit.