REST API - Search for Change-Number/sys id with Task-Number

Benedikt Kaiser
Tera Contributor

Hi all,

I am currently trying to search for a change-number or change-sysID with an underlying task-Number of the change.

I am trying this with GET Change, however I am not able to find the correct solution.

curl "https://instance.servicenow.com/api/sn_chg_rest/v1/change\
--request GET \
--header "Accept:application/json" \
--user "username":"password"

 

Does someone know how to tackle this problem?

Thank you and best regards, 
Benedikt

 
1 ACCEPTED SOLUTION

Jaspal Singh
Mega Patron
Mega Patron

Hi,

Did you try using REST API explorer? 

Navigate to System Web Services >> REST >> REST API Explorer

Select table: change_task

Sometihng as attached.find_real_file.png

find_real_file.png

 

So, final query will be something as below

https://dev20466.service-now.com/api/now/table/change_task?sysparm_query=number%3DCTASK0010066&sysparm_display_value=true&sysparm_fields=change_request%2Cnumber

Where dev20466 is instance name.

View solution in original post

5 REPLIES 5

Smriti Rastogi
Kilo Guru

you need to add a query parameter where change ticket number is equal to let say CHG0192030.

Benedikt Kaiser
Tera Contributor

I do not have the change ticket number (for example CHG0192030). 

I just have number of a change-task within the change. So lets say I just have the CTASK1234568. Based on this CTASK I want to find the connected change-request-number.

 

If you are using flow designer then you can dynamically pass the change number as a query parameter by dotwalking from change task . 

 

 

Jaspal Singh
Mega Patron
Mega Patron

Hi,

Did you try using REST API explorer? 

Navigate to System Web Services >> REST >> REST API Explorer

Select table: change_task

Sometihng as attached.find_real_file.png

find_real_file.png

 

So, final query will be something as below

https://dev20466.service-now.com/api/now/table/change_task?sysparm_query=number%3DCTASK0010066&sysparm_display_value=true&sysparm_fields=change_request%2Cnumber

Where dev20466 is instance name.