beaugotro
beaugotro

Reputation: 31

ServiceNow Rest API

I'm trying to get change information for sets of servers. Here is the command I'm using:

`curl --user USERNAME:PASSWORD  https://myurl.service-now.com/api/now/table/change_request > output`

When trying to get info from the change_request table I get the following error:

"error":{"detail":"Transaction cancelled: maximum execution time exceeded Check logs for error trace or enable glide.rest.debug property to verify REST request processing","message":"Transaction cancelled: maximum execution time exceeded"},"status":"failure"}

It seems I'm trying to grab too much information at once. Any suggestions to break this down into smaller parts? It's pulling all change information for all systems. How would I get information for say maybe just AIX production servers, or Linux test servers?

Upvotes: 0

Views: 2796

Answers (1)

techskipow
techskipow

Reputation: 21

This API call is going to return everything in the change_request table. If your instance has a large amount of data in that table, it is most likely exceeding the return time. Additionally, you need a sysparm_query in you api call that will limit your call to, what I would assume, the CIs in the CMDB associated with the change requests with the class AIX_server or Linxu_server.

A really good place to play around with this is the REST API Explorer. This will allow you to get get the right data and the right amount.

Additionally, if you want all this data, you will likely need to paginate through the data (making multiple calls).

Upvotes: 2

Related Questions