Modify Status Code Rest API Call

sammajumder
Giga Contributor

Hi

We have requirement to modify status code of a rest api call.We are doing integration using staging tables.Once data is received through Rest Import set API, the status code is set as 201 Created but when our transform scripts run it may throw error depending upon validation. We are throwing error through status_message and error_message variables but we would also want to modify the status code. I am attaching screenshot for reference. Is there any way to achieve this?Status Code.png

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

As far as I know, the status codes are standard HTTP Response Codes defined at the platform layer. They are not configurable or overriding. Doing so could cause serious problems with other integrations.



You MAY be able to change them if you use a script REST API of your own. I haven't checked in this lately.



Getting Started with REST - ServiceNow Wiki


REST API Explorer - ServiceNow Wiki


REST API  


Scripted REST APIs


View solution in original post

5 REPLIES 5

Chuck Tomasi
Tera Patron

As far as I know, the status codes are standard HTTP Response Codes defined at the platform layer. They are not configurable or overriding. Doing so could cause serious problems with other integrations.



You MAY be able to change them if you use a script REST API of your own. I haven't checked in this lately.



Getting Started with REST - ServiceNow Wiki


REST API Explorer - ServiceNow Wiki


REST API  


Scripted REST APIs


Thanks Chuck. I was expecting the same but still wanted to check.


If I have answered your question, please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list.



If you are viewing this from the community inbox you will not see the correct answer button.   If so, please review How to Mark Answers Correct From Inbox View.



Thank you


Check below available error objects. But yes as stated by Chuck doing so could cause serious problems with other integrations.



Available error objects




Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy