Attachment Upload REST Message Returning 401 Unauthorized While Create and Update Methods Work Using

jeevithr
Mega Contributor

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:

401 Unauthorized

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.

9 REPLIES 9

jeevithr_0-1793258647400.pngjeevithr_1-1793258686224.png

the same thing was done for create and update incident HTTP method too it was working but for upload attachment method authentication is not working

Hi @jeevithr 

 

Did you test it using Postman.

 

Can you share the screen shot of Http parameters under http request tab.

Ankur Bawiskar
Tera Patron

@jeevithr 

which API you are using?

OOTB Attachment API or Scripted REST API endpoint?

scripted REST API endpoint

@jeevithr 

how are you sending the JSON request body to that scripted REST API endpoint?

what's the script within that?

💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏