There is a Cancel button on our ServiceNow Request Items, when clicked it sets the Stage to "Request Cancelled" and State to "Closed Incomplete"
How do I achieve the same but using the ServiceNow's REST API? I've tried sending a POST to:
"$instanceURL/api/now/table/sc_req_item/$ritmSysID/cancel"
but get error:
Error: The remote server returned an error: (400) Bad Request.
Response Content: {"error":{"message":"Requested URI does not represent any resource","detail":null},"status":"failure"}

you need to send a PATCH request to /api/now/table/change_request/{sys-id-of-change-request} with a payload having state as 4
{ "state": "4", "work_notes": "Canceling change" }