Search code examples
pythonamazon-advertising-api

Amazon advertisement api asins report type returning empty list


I am trying to get the asins report from amazon advertising api. The header and json for creation of the report as follows,

headers = {
        "Authorization": f"Bearer {access_code}",
        "Amazon-Advertising-API-ClientId": "client_id",
        "Amazon-Advertising-API-Scope": "Profile_id"
    }

asins_json_data = {
    "reportDate": "20220227",
    "campaignType": "sponsoredProducts",
    "metrics": ",".join([
        "adGroupId",
        "adGroupName",
        "asin",
        "attributedSales14dOtherSKU",
        "attributedSales1dOtherSKU",
        "attributedSales30dOtherSKU",
        "attributedSales7dOtherSKU",
        "attributedUnitsOrdered14d",
        "attributedUnitsOrdered14dOtherSKU",
        "attributedUnitsOrdered1d",
        "attributedUnitsOrdered1dOtherSKU",
        "attributedUnitsOrdered30d",
        "attributedUnitsOrdered30dOtherSKU",
        "attributedUnitsOrdered7d",
        "attributedUnitsOrdered7dOtherSKU",
        "campaignId",
        "campaignName",
        "currency",
        "keywordText",
        "matchType",
        "otherAsin",
        "targetingExpression",
        "targetingType"

    ])

The creation of the report returns this,

{'recordType': 'otherAsin',
 'reportId': 'report_id',
 'status': 'IN_PROGRESS',
 'statusDetails': 'Report is being generated.'}

Get request for the report data returns,

{'expiration': 1654041600000,
 'fileSize': 22,
 'location': 'https://advertising-api-eu.amazon.com/v1/reports/report_id/download',
 'reportId': 'report_id',
 'status': 'SUCCESS',
 'statusDetails': 'Report has been successfully generated.'}

but when calling the location link and as well as trying with the V2 link which is "https://advertising-api-eu.amazon.com/v2/reports/report_id/download", I get back an empty list like this,

[]

There should be data for the date as well, any idea why this is happening?


Solution

  • I have figured it out, there is a conflict for some reason, if I put both "asin" and "otherAsin" in the asins_json_data dictionary. It has to be either one of them in the metrics. According to the official document it should not happen. But it also depends on the campaign itself, if they contain the attributes, they should not conflict, vice versa otherwise.