The customer is trying to query the API for information however the request are failing with "Authorization Required" error.
This may not necessarily be an authentication issue, the API calls have a number of mandatory requirements.
The most common issue we see is that a header is missing, the below code snippet is a good example of how the call should be performed.
import json
conn = http.client.HTTPSConnection("api.eu.elastica.net")
payload = ''
headers = {
'Content-Type': 'application/json',
'X-Elastica-Dbname-Resolved': 'True',
'Authorization': 'Basic ■■■■■■■■■■■■■■■■■■■■■'
}
conn.request("GET", "/mytenantname/audit/v2/data/?resource=service&earliest_date=1638349200&latest_date=1640077200&resolution=31556926&brr=80,85", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
The basic auth is an amalgamation of the user and secret strings.
As per the above the X header and the Content-Type headers are both mandatory.
see the link below for more detail and how you can perform initial testing with the postman tool.
401 unauthorized using API Keys with SIEM or the Cloudsoc API
Also check out the links below which detail the requirement for the X header and the basic request format….
Cloudsoc APIs - Authentication