How to cancel a change from the REST API?

dnlhoust
Kilo Contributor

Everytime I try to move the state of a New change to -4 (Cancelled) I get a 400 BAD REQUEST back, but no more information as to what information is needed in the request

How can I cancel a change via the REST API?

3 REPLIES 3

MrMuhammad
Giga Sage

Hi, 

 

You can use PATCH method to cancel the change request.

End point

https://<instance_name>.com/api/now/table/change_request/<sys_id_of_CR>

Payload

{"state":"4"} // 4 = Cancel

 

Please mark this accepted/helpful, if applicable.

 

Thanks & Regards,

Sharjeel

Regards,
Muhammad

Thanks Sharjeel.

This works - but why is this against the table API and not the change request API?

I am endlessly confused as to why there is two endpoints for interacting with records.

 

Glad it worked!

 

I believe Change request API gives the ability to control in depth process of change management e.g.

  • Updating any field that exists in the change task table and work tasks from creation through closure/cancellation.
  • Retrieve a specific change request, standard template, or change request task.
  • Retrieve multiple change requests, standard templates, or change request tasks using pagination.
  • Generate and process any related approval activity associated with a change request.
  • Identify potential scheduling conflicts and identify periods where conflicts do not exist.

I hope this helps.

 

Please mark this accepted/helpful, if applicable.

 

Thanks & Regards,

Sharjeel 

Regards,
Muhammad