无法调用ServiceNow API创建事件工单,Postman报用户未认证错误
Let’s walk through the most practical fixes for this issue, since you’ve already tried setting up Basic Auth and sending a JSON request body:
Double-check your Basic Auth configuration in Postman
First, confirm you’ve selected Basic Auth in the Auth tab (not any other auth type). ServiceNow usually expects usernames without a domain prefix—for example, useadmininstead ofCORP\admin. If your password has special characters, Postman’s auto-encoding might cause issues; try manually encoding yourusername:passwordstring to Base64 and adding it directly to the request header like this:Authorization: Basic <your-base64-string>. This bypasses any auto-encoding quirks in Postman.Verify your request headers are correctly set
ServiceNow’s REST API requires theContent-Type: application/jsonheader to process your request body. If this header is missing or set to something else (likeapplication/x-www-form-urlencoded), even valid JSON will cause problems. Also, check for conflicting auth headers—sometimes Postman retains old Bearer Tokens or other auth settings from previous requests. Stick to these essential headers:Authorization: Basic <your-encoded-creds>Content-Type: application/jsonAccept: application/json(optional but ensures you get consistent JSON responses)
Confirm your user account has the right permissions
Even if your username and password are correct, ServiceNow might return an auth error if the account doesn’t have permission to create incidents. Log into your ServiceNow instance and check that the user has at least theitilrole (or a custom role withincident_writeaccess). Also, make sure the account isn’t locked, expired, or restricted to specific IP addresses.Validate your API endpoint and test with a GET request
Double-check that your endpointhttps://xxxx.service-now.com/api/now/v1/table/incidentuses the correct instance prefix (xxxx). To isolate the issue, try sending a GET request to the same endpoint (to fetch incident records)—if you get the same auth error, the problem is with your credentials/account, not the create action itself.Rule out Postman environment/global variable interference
Postman’s global or environment variables can override your request-specific auth settings. Click the "Clear Cookies" button in Postman, then in the Auth tab, select "Current Request" to ensure your Basic Auth is only applied to this call. You can also temporarily disable any global variables to see if they’re causing conflicts.
Here’s a sample working request you can test in Postman (replace placeholder values with your own):
POST https://xxxx.service-now.com/api/now/v1/table/incident Authorization: Basic dXNlcjE6cGFzc3dvcmQ= Content-Type: application/json { "short_description": "Test incident from Postman", "description": "Troubleshooting auth error", "caller_id": "admin" }
内容的提问来源于stack exchange,提问作者Venkatesh Voona

