You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
1-bug: reports.py-41 kwargs.pop('body') is error,Nofound body in kwargs.
2-bug: client.py-239 Content-type is incorrect, resulting in a return status of 400/422, params should not use the passed data.In general there are multiple errors here
sponsored_products Reports post_report
Not submitting the request with the Content-type will result 422/400 status_code。
Activity
denisneuf commentedon Aug 2, 2022
Check the help:
https://python-amazon-ad-api.readthedocs.io/en/latest/sp/reports.html
You are using wrong you need to pass your values as a dictionary:
from ad_api.api.sp.reports import Reports
file = open("ad_groups.json")
data = file.read()
file.close()
record_type = 'adGroups'
result = Reports().post_report(
recordType=record_type,
body=data
)
payload = result.payload
report_id = payload.get('reportId')
While the dictionary should look like this:
{
"stateFilter": "enabled",
"reportDate": "20210917",
"metrics": "campaignName,campaignId,adGroupName,adGroupId,impressions,clicks,attributedConversions30d"
}