Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Adobe Analytics REST API 403 Error

Avatar

Level 1

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

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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?

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

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?