The CreatorCon Call for Content is officially open! Get started here.

How to query servicenow tickets using its API (powershell)

Matt Campbell1
Kilo Contributor

Hello, I'm playing around with the SNOW API. 

I'm trying to figure a method to query for task numbers from this table sc_task.

Hoping to get some help with this.

Currently on Jakarta for SNOW

$uri = "https://xxxxxxx.service-now.com/api/now/table/sc_task? 

This my URL i'm using but i'm not sure what to add at the end of this URI to query a specific task number.

 

Thanks,

Matt

 

1 ACCEPTED SOLUTION

Ok..Do thhis

 

https://xxxxxxx.service-now.com/api/now/table/sc_task?sysparm_query=number=<Task Number>

 

The task number should be in format TASK0001231

 

For ex, I used

 

https://xxxxxxx.service-now.com/api/now/table/sc_task?sysparm_query=number=TASK0000001


Please mark this response as correct or helpful if it assisted you with your question.

View solution in original post

9 REPLIES 9

SanjivMeher
Mega Patron
Mega Patron

$uri = "https://xxxxxxx.service-now.com/api/now/table/sc_task?sys_id=<sysid of the record>"


Please mark this response as correct or helpful if it assisted you with your question.

What is the sys id? I was trying to figure that out, can I just put in the TASK number from the ticket? 

 

 

If you want to use number, use below url

 

https://xxxxxxx.service-now.com/api/now/table/sc_task?sysparm_query=number%3D'<Task Number>'


Please mark this response as correct or helpful if it assisted you with your question.

I tried using that method, results in Null response.

 

Do you have to be on a specific version of snow to use that?