API Get sys_id using a Change Number

Ninh V Bui
Kilo Contributor

Hi all, 

Objective: Use API to get sys_id using a Change Number

I'm new to scripting and I am using POSTMAN to use ServiceNow API to request for response in order to pass data on to other APIs for other apps. 

I know that you can GET a response from a Change record if you have its sys_id but can we do the opposite? Is there a way to search up using the CHG number and have it respond back the sys_id record?

What I'm looking for is when we get a Change number coming through an email. We copy that Change number into the script and it goes and open up that sys_id record. Instead of us having to go through the CHG record > Right click and copy sys_id

Any help would be much appreciated. 

Thank you




1 ACCEPTED SOLUTION

vkachineni
Kilo Sage
Kilo Sage

In post man you can do a get

 

https://####.service-now.com/api/now/table/change_request?sysparm_query=number%3DCHG0001090

 

Gets the sys_id

 

            "follow_up": "",
            "sys_id": "76732a25d7223100b96d45a3ce6103e5",
            "contact_type": "phone",

 

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

View solution in original post

3 REPLIES 3

vkachineni
Kilo Sage
Kilo Sage

In post man you can do a get

 

https://####.service-now.com/api/now/table/change_request?sysparm_query=number%3DCHG0001090

 

Gets the sys_id

 

            "follow_up": "",
            "sys_id": "76732a25d7223100b96d45a3ce6103e5",
            "contact_type": "phone",

 

Please mark Correct and click the Thumb up if my answer helps you resolve your issue. Thanks!
Vinod Kumar Kachineni
Community Rising Star 2022

Thank you very much for your answer. That worked better.

User658880
Tera Expert

Use the Rest API Explorer to do a 'Get Records' calls - you can specify condition fields

find_real_file.png