Attachment Upload REST Message Returning 401 Unauthorized While Create and Update Methods Work Using
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Everyone,
We are working on a ServiceNow-to-ServiceNow incident integration.
The parent REST Message is configured with Basic Authentication. The authentication is working correctly for the child methods:
- Create Incident ✅
- Update Incident ✅
Both methods inherit authentication from the parent REST Message and execute successfully.
However, we recently added an Attachment Upload method under the same REST Message. This method should inherit the same authentication settings, but it is returning:
Additional observations:
- The attachment endpoint works when tested directly through REST API Explorer.
- The Scripted REST API returns HTTP 200 when tested independently.
- The log statement "UPLOAD ATTACHMENT API HIT" is never generated when the REST Message executes, which suggests the request may be failing before reaching the Scripted REST API.
- Endpoint URL and credentials have been verified.
- Since Create Incident and Update Incident are working with the same parent REST Message authentication, we do not believe the credentials themselves are incorrect.
Has anyone encountered a situation where child methods under the same REST Message inherit authentication differently, or where an attachment upload method returns 401 while other methods work successfully?
Any suggestions on logs, authentication settings, or method-level configurations that we should verify would be greatly appreciated.
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @jeevithr,
The Attachment Upload method is sending the wrong or conflicting headers, so the target instance rejects the request with 401 before your script runs. Check the content type in the header which type did the methods accepts.
- Open the Attachment Upload method, go to HTTP Request → Headers, and remove anything that isn’t needed.
- Set only the correct Content-Type for the file.
- Verify that the HTTP method parameters match the field names expected by the target instance.
Regards,
Tarun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
we tried too but still its an 401 error
thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @jeevithr,
Once check in the Scripted REST API endpoint script.
Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards,
Tarun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @jeevithr
Share the screen shot of your upload attachment method. What content type have you set?