SP-API Reports Endpoit returns 403 Error
I've build this app to retrieve data for our internal reports. The app has all roles and permissions assigned to it. Nevertheless, I can access all SP-API endpoints except for the most important one: Reports.
They all return an 403 erros: [{'code': 'Unauthorized', 'message': 'Access to the resource is forbidden', 'details': ''}]
Sample Request (using python requests module)
url = 'https://sellingpartnerapi-na.amazon.com/reports/2021-06-30/reports'
headers = {
# 'host': 'https://sellingpartnerapi-na.amazon.com',
'user-agent': f'{AppId}/{AppVersion} (Language={LanguageName}/{LanguageVersion})',
'x-amz-access-token': atoken,
'x-amz-date': f'{datetime.datetime.now().strftime("%Y%m%dT%H%M%SZ")}'
}
payload = {
"reportOptions": {
"reportPeriod": "DAY",
"asinGranularity": "SKU"
},
"reportType": "GET_SALES_AND_TRAFFIC_REPORT",
"dataStartTime": f"{dataStartTime}",
"dataEndTime": f"{dataEndTime}",
"marketplaceIds": [
"ATVPDKIKX0DER"
]
}
r = requests.post(url, json=payload, headers=headers)
What am I missing here?
SP-API Reports Endpoit returns 403 Error
I've build this app to retrieve data for our internal reports. The app has all roles and permissions assigned to it. Nevertheless, I can access all SP-API endpoints except for the most important one: Reports.
They all return an 403 erros: [{'code': 'Unauthorized', 'message': 'Access to the resource is forbidden', 'details': ''}]
Sample Request (using python requests module)
url = 'https://sellingpartnerapi-na.amazon.com/reports/2021-06-30/reports'
headers = {
# 'host': 'https://sellingpartnerapi-na.amazon.com',
'user-agent': f'{AppId}/{AppVersion} (Language={LanguageName}/{LanguageVersion})',
'x-amz-access-token': atoken,
'x-amz-date': f'{datetime.datetime.now().strftime("%Y%m%dT%H%M%SZ")}'
}
payload = {
"reportOptions": {
"reportPeriod": "DAY",
"asinGranularity": "SKU"
},
"reportType": "GET_SALES_AND_TRAFFIC_REPORT",
"dataStartTime": f"{dataStartTime}",
"dataEndTime": f"{dataEndTime}",
"marketplaceIds": [
"ATVPDKIKX0DER"
]
}
r = requests.post(url, json=payload, headers=headers)
What am I missing here?
0 replies
Quincy_Amazon
Hello @Seller_ZHBKu4aywF9ak
Thank you for posting your inquiry to the Forums.
While I am not able to answer your question, I would suggest opening a case with Developer Support for additional guidance.
Regards,
Quincy_Amazon