TripToBelize
TripToBelize

Reputation: 73

How to send a Cancel action to ServiceNow Request Item via the REST API?

There is a Cancel button on our ServiceNow Request Items, when clicked it sets the Stage to "Request Cancelled" and State to "Closed Incomplete"

Clicking Cancel button

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"}

Upvotes: 0

Views: 512

Answers (1)

subram
subram

Reputation: 189

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" }

Upvotes: 0

Related Questions