I'm trying to get report data through Apple Search Ads API. So I use the method -H ...\ -d "@TestSearchTermReport.json" -X POST "/v1/reports/campaigns/{cId}/searchterms"
I have included all the headers and credentials. The following is the content of my json data file for the POST body: { "startTime": "2016-11-13", "endTime": "2016-11-13", "timezone": "UTC", "granularity": "DAILY", "selector": { "orderBy":[{"field":"spend","sortOrder":"DESCENDING"}], "fields": ["spend", "taps", "conversions", "avgCPA", "avgCPC", "ttr", "conversionRate"], "pagination": { "offset": 0, "limit": 1000 } }, "groupBy": "countryCode", "returnRowTotals": False, "returnRecordsWithNoMetrics": False }
However, I get the following error message:
{"data":null,"pagination":null,"error":{"errors":[{"messageCode":"INVALID_JSON_REQUEST","message":"This is an invalid json. The request can not be parsed","field":"Line#:1 Column#:3"}]}}
I have tried many times through different ways, but still not working. Is there any smart guys can help me?
Thanks in advance!
I've just been struggling with this API myself, the documentation is not exactly user friendly!
Looks like you have a few issues here:
As you're using python, try this:
This returns a successful response for me. Hope it works for you too!