- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 11:45 AM - edited 01-07-2025 01:13 PM
Hi,
We have data coming from an external service to our import set staging table via REST POST. The response will contain the status code of 200, 201, 400, etc. Can we access this status code via some script? We would like to create an INC for ourselves if we find an error status code in the response.
Thanks,
DP
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 02:18 AM
Hi @dp11 ,
I don't think it is possible to get the status code as the target system in REST framework. The status code is meant for the source system, who is sending the request, as part of response to know whether the request got processed successfully.
For the target system, which is ServiceNow in this case, you need to verify the success of an incoming request based on records' update or insert in the stage or target table.
If this address your question, please don't forget to mark this response correct by clicking on Accept as Solution and/or Kudos.
You may mark this helpful as well if it helps you.
Thanks,
Animesh Das
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-07-2025 01:43 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 02:18 AM
Hi @dp11 ,
I don't think it is possible to get the status code as the target system in REST framework. The status code is meant for the source system, who is sending the request, as part of response to know whether the request got processed successfully.
For the target system, which is ServiceNow in this case, you need to verify the success of an incoming request based on records' update or insert in the stage or target table.
If this address your question, please don't forget to mark this response correct by clicking on Accept as Solution and/or Kudos.
You may mark this helpful as well if it helps you.
Thanks,
Animesh Das
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2025 02:31 AM
so 3rd party is consuming import set API and you want to know the status code?
As far as I know, the status codes are standard HTTP Response Codes defined at the platform layer. They are not configurable or overriding.
You can try to use Scripted REST API but I haven't tried using that with status code.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-09-2025 06:38 PM
Thank you for marking my response as helpful.
As per new community feature you can mark multiple responses as correct.
If my response helped please mark it correct as well so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader