Use REST API to get details of a Change Request

Shikhar Tandon
Kilo Contributor

Hi,

I am very new to this SNOW.

I am looking for help in REST API solution where I can pass the Change Request Number and in the output response I can get the Change request values like "Type", "Configuration Item", "Short description", "description".

Something like - https://test.service-now.com/api/sn_chg_rest/change/standard/CHG1234567

some this kind of URL and in response the values of these fields from the CRQ - "Type", "Configuration Item", "Short description", "description".

Looking forward for some help.

Thanks

1 ACCEPTED SOLUTION

Hi @Shikhar Tandon ,

CI is also coming in correct format. This is how ServiceNow provides results for any reference field. If you are expecting Display value of CI, then make sysparm_display_value as true.

Then, your response would look like -

{
  "result": {
    "short_description": "testing else part",
    "cmdb_ci": {
      "link": "https://instance.service-now.com/api/now/table/cmdb_ci/f383a25ddb80d890bcb8dd3b5e96197a",
      "display_value": "HelloCI"
    },
    "description": "Datachange  Request"
  }
}

Let me know if issue persists.

Mark this as Correct answer and close this thread for reference to other people seeking same info.

Regards,

Shubham

 

View solution in original post

18 REPLIES 18

Arav
Tera Guru
Tera Guru

Hi Shikhar,

Please start with Table APIs (please see below link).

https://developer.servicenow.com/dev.do#!/reference/api/tokyo/rest/c_TableAPI

For complex scripting, you may want to explore Scripted REST APIs.

Thanks,

Arav

Hi Arav,

Thanks for the reply.

 I have explored this page, I also tried with the REST API Explorer passed the Table name like Change Request and the sys id there but not getting the required results.

Thanks

Maybe adding screenshots with the issue will help us see what's going wrong.

Wojtek Winnicki
Tera Guru

Hello @Shikhar Tandon 

try using the Table API. Here is an example of endpoint that you are interested. It will return all of the values on the change record.

GET https://test.service-now.com/api/now/table/change_request?sysparm_query=task_effective_number%3DCHG1234567&sysparm_limit=1