Skip to main content
May 23, 2022
Solved

Adobe Analytics REST API 403 Error

Hi ,

 

I am trying to access the Adobe Analytics using REST API 2.0. I am able to access the token(jwt, access token) successfully but getting an error when i try to access the report. The response.status code is 403 

 

Here is the python code for your reference

 this is from Adobe Developer Console with true changed to True
jwt_payload = {"exp":datetime.datetime.utcnow() + datetime.timedelta(seconds=30),
"iss":"xx@AdobeOrg",
"sub":"xx@techacct.adobe.com",
"https://ims-na1.adobelogin.com/s/example_sdk":True,
"aud":"https://ims-na1.adobelogin.com/c/f'{client_id}"}
# generate an expiry date +1 day and make it an integer




# encrypt the jwt_payload with our private key
jwt_payload_encrypted = jwt.encode(jwt_payload, private_key, algorithm='RS256')

access_token_request_payload = {'client_id': f'{CLIENT_ID}',
'client_secret': f'{CLIENT_SECRET}',
"jwt_token":f'{jwt_payload_encrypted}',}

access_token_request_payload['jwt_token'] = jwt_payload_encrypted.decode('UTF-8')

# make the post request for our access token
# for this to work we need to use "data=" to generate the right headers
# using json= or files= won't work
response = requests.post(url=JWT_URL, data=access_token_request_payload)
response_json = response.json()
# set our access token
ACCESS_TOKEN = response_json['access_token']
print(response.status_code) - 200

headers = {
'accept': 'application/json',
'x-api-key': 'xx',
'Authorization': f'{ACCESS_TOKEN}',
}

params = {
'limit': '10',
'page': '0',
}

response1 = requests.get('https://analytics.adobe.io/api/mohawk3/users', params=params, headers=headers)
print(response1.status_code) - Response says 403

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Alexis_Cazes_
Alexis_Cazes_Accepted solution
Level 10
May 27, 2022

Did you add Bearer before the access token ? 

 

Also did you try to use Postman first to make sure you can access the api? Does your technical account has the correct rights in adobe analytics to query things?

1 reply

Alexis_Cazes_
Alexis_Cazes_Accepted solution
Level 10
May 27, 2022

Did you add Bearer before the access token ? 

 

Also did you try to use Postman first to make sure you can access the api? Does your technical account has the correct rights in adobe analytics to query things?

Translate