Evident Monitoring API calls fail with error code 401 (Access Denied)
Evident Monitoring API calls fail with error code 401 (Access Denied)
0
Created On 09/26/18 13:45 PM - Last Modified 07/19/22 23:08 PM
Symptom
Symptoms
Running the script will result with error code 401. For example, the following is the error generated with Ruby SDK:
/Users/esp-user/.rvm/gems/ruby-2.3.0/gems/activeresource-4.0.0/lib/active_resource/connection.rb:140:in `handle_response': Failed.Response code = 401.Response message = Access Denied. (ActiveResource::UnauthorizedAccess) from /Users/esp-user/.rvm/gems/ruby-2.3.0/gems/activeresource-4.0.0/lib/active_resource/connection.rb:123:in `request' from /Users/esp-user/.rvm/gems/ruby-2.3.0/gems/api-auth-2.0.1/lib/api_auth/railtie.rb:87:in `request_with_auth' from /Users/esp-user/.rvm/gems/ruby-2.3.0/gems/activeresource-4.0.0/lib/active_resource/connection.rb:100:in `block in put' from /Users/esp-user/.rvm/gems/ruby-2.3.0/gems/activeresource-4.0.0/lib/active_resource/connection.rb:216:in `with_auth' from /Users/esp-user/.rvm/gems/ruby-2.3.0/gems/activeresource-4.0.0/lib/active_resource/connection.rb:100:in `put' from /Users/esp-user/.rvm/gems/ruby-2.3.0/gems/esp_sdk-2.7.0/lib/esp/resources/resource.rb:31:in `where' from test1.rb:15:in `<main>'
Note: depending on the script language, the error may appear differently.
Diagnosis
API access key ID or secret key
Create a new set of API access key and secret key and use that set to make the API call.
Lack of Permission
Try a simple API call such as return all Users. Ruby SDK Example:
If you are able to run a simple call, then it is likely your user does not have sufficient permission to access certain resources. If possible, try to access the same resources in Evident Monitoring Web UI.
Oudated SDK version
Check the following GitHub repositories and make sure you are running the latest SDK version:
Check if your code contains references to any external libraries that may conflict with Evident Monitoring SDK, e.g. ActiveResources
Request Header
If you are not using an Evident Monitoring SDK, review your request header and make sure formatting, encoding, and encryption are all performed correctly. Check the following examples: