- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 02:28 AM
Hi,
I am configuring sending attachments from Incident (ServiceNow) to Other ServiceNow instances using the custom app. I configured the below script in BR. But it is always failing with 401 errors. (As below)
{"error":{"message":"Invalid file type: application/json","detail":null},"status":"failure"}
------------------------BR Script-------------------
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 01:24 AM
did you check the links I shared yesterday?
Unable to send attachment via REST
Business rule to send attachment to 3rd Party Tool via REST
Send attachment via rest message
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 05:38 AM
Thanks All,
We are missing adding these parameters in the rest endpoint. (highlighted in red). Only sent over BR but missed adding in the end point. It's working now.
https://******.service-now.com/api/now/attachment/file?table_name=${table_name}&table_sys_id=${table_sys_id}&file_name=${file_name}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 03:13 AM
The issue is not with the code, the issue is with the username password as 4-1 errors are there.
A "401 Unauthorized" error in ServiceNow integrations indicates that the system is unable to access the requested data due to invalid authentication credentials, meaning the username and password used to connect to the external system are incorrect or lack the necessary permissions to access the specified data within ServiceNow.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 03:16 AM
Also Please check what type of authentication method you are using and if it is basic check the user profile is having proper roles or not.
Regards,
Debasis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 01:16 AM
Hi Debasis,
Its not 401 error. Credential is working. We use the same credentials (Auth 2.0) for other updates. It's giving 400 error, whichs means the Json is not supporting. File error.
: {"error":{"message":"Invalid file type: image/jpeg","detail":null},"status":"failure"}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 01:24 AM
did you check the links I shared yesterday?
Unable to send attachment via REST
Business rule to send attachment to 3rd Party Tool via REST
Send attachment via rest message
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2025 05:38 AM
Thanks All,
We are missing adding these parameters in the rest endpoint. (highlighted in red). Only sent over BR but missed adding in the end point. It's working now.
https://******.service-now.com/api/now/attachment/file?table_name=${table_name}&table_sys_id=${table_sys_id}&file_name=${file_name}
