- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2025 10:04 AM
Hello
using
curl -s -X POST "%baseurl%/api/now/table/incident?sysparm_display_value=true&sysparm_exclude_reference_link=true&sysparm_fields=number%2Cshort_description" ^
--header "Accept:application/json" ^
--header "Content-Type:application/json" ^
--data "{\"short_description\":\"Alert from BMCAMI Command Center\",\"description\":\"%T_MESSAGE%\",\"Urgency\":\"%turgency%\"}" ^
--user %user%:%pwd%
i receive
{"error":{"message":"User Not Authenticated","detail":"Required to provide Auth information"},"status":"failure"}^C
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2025 07:41 AM
Hello @maurizio Tarduc
If your password contains special characters (like ^), they might need to be escaped or enclosed in quotes.
Ensure that the password is correctly encoded. Sometimes, special characters can cause issues if not properly encoded.
Verify that the admin user has the necessary roles and permissions to access the REST API. The user should have the rest_api_explorer role or similar.
Check this KB article also
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0812242
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2025 09:01 PM
Hello @maurizio Tarduc
Ensure that the username (%user%) and password (%pwd%) are correct and have the necessary permissions to access the ServiceNow instance.
Make sure you are using Basic Authentication correctly. The --user option should be in the format username:password.
I believe the user has the appropriate roles assigned if not please do the needful.
Use a tool like Postman to test the API call. This can help isolate whether the issue is with the curl command or the ServiceNow configuration.
Example how to use basic auth with curl:
curl -s -X POST "https://your_instance.service-now.com/api/now/table/incident?sysparm_display_value=true&sysparm_exclude_reference_link=true&sysparm_fields=number,short_description" \
--header "Accept:application/json" \
--header "Content-Type:application/json" \
--data "{\"short_description\":\"Alert from BMCAMI Command Center\",\"description\":\"%T_MESSAGE%\",\"urgency\":\"%turgency%\"}" \
--user "your_username:your_password"
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2025 02:53 AM
Hi thanks first of all
i did a test with the following result
C:\Program Files\BMC Software\BMC Defender\t-actions>curl -s -X POST "https://dev197239.service-now.com/api/now/table/incident?sysparm_display_value=true&sysparm_exclude_..." --header "Accept:application/json" --header "Content-Type:application/json" --data "{\"short_description\":\"Alert from BMCAMI Command Center\",\"description\":\"\",\"urgency\":\"\"}" --user "admin:0hUgJ8vVZ^m"
{"error":{"message":"User Not Authenticated","detail":"Required to provide Auth information"},"status":"failure"}
C:\Program Files\BMC Software\BMC Defender\t-actions>
if i logon with admin and the password from the browser the login is ok.
let me know if you need to know some other details
Maurizio
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2025 07:41 AM
Hello @maurizio Tarduc
If your password contains special characters (like ^), they might need to be escaped or enclosed in quotes.
Ensure that the password is correctly encoded. Sometimes, special characters can cause issues if not properly encoded.
Verify that the admin user has the necessary roles and permissions to access the REST API. The user should have the rest_api_explorer role or similar.
Check this KB article also
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0812242
If my response has helped you hit helpful button and if your concern is solved do mark my response as correct.
Thanks & Regards
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2025 03:19 AM
Hi i changed the password to a more simple and everything worked correctly .
thanks
Maurizio