What is the correct json content format for reporting POST method?

Hello,


I'm trying to get report data for my organization through Apple Search Ads API. So I use the method

-H ...\

-d "@TestSearchTermReport.json"

-X POST "<ROOT_PATH>/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!

Replies

Hi,

I hope you fixed the issue by now. I had a similar problem and I think it was because the options sent in the json are case sensitive. For example timezone should be timeZone . Hope this helps someone