【问题标题】:Apple Search Ads returning error while "groupBy" clauseApple Search Ads 在“groupBy”子句中返回错误
【发布时间】:2019-09-17 19:34:39
【问题描述】:

我已经设置了一个查询 Apple Search Ads API 的工具,可以在 here 找到它的文档。 可以将“groupBy”子句传递给请求,如下所示:

curl -X POST https://api.searchads.apple.com/api/v1/reports/campaigns  \
-H 'Content-Type: application/json'  \
-H 'Authorization: orgId=1056160'  \
-E pem.pem --key key.key \
-d '{"selector": {"pagination": {"limit": 10, "offset": 0}, "orderBy": [{"sortOrder": "DESCENDING", "field": "campaignId"}]}, "returnRecordsWithNoMetrics": false, "granularity": "DAILY", "returnRowTotals": false, "timeZone": "UTC", "endTime": "2019-03-27", "startTime": "2019-02-27", "groupBy": "countryCode"}' \
| python -m json.tool

并期望返回按countryCode 分组的数据。

但是,自 2019 年 4 月 23 日起,API 开始返回错误:

{
    "data": null,
    "error": {
        "errors": [
            {
                "field": "Line#:1 Column#:292",
                "message": "This is an invalid request. At least one field format is not readable by the system.",
                "messageCode": "INVALID_ATTRIBUTE_TYPE"
            }
        ]
    },
    "pagination": null
}

我尝试在网上寻求帮助,但到目前为止还不够。 任何帮助将不胜感激。

【问题讨论】:

    标签: api curl apple-search-ads


    【解决方案1】:

    您要访问哪个报告端点?

    报告/活动?

    如果是活动端点,请尝试此有效负载:

    {
        "startTime": "2019-02-27",
        "endTime": "2019-03-27",
        "granularity": "DAILY",
        "selector": {
            "orderBy": [
                {
                    "field": "campaignId",
                    "sortOrder": "DESCENDING"
                }
            ],
            "conditions": [
            ],
            "pagination": {
                "offset": 0,
                "limit": 10
            }
        },
         "groupBy": [
            "countryCode"
        ],
        "timeZone": "UTC",
        "returnRecordsWithNoMetrics": false,
        "returnRowTotals": false,
        "returnGrandTotals": false
    }
    

    【讨论】:

    • @mastersifu,将groupBy 子句添加为数组而不是字符串,有效。谢谢!
    猜你喜欢
    • 2017-03-31
    • 2020-05-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-03
    • 1970-01-01
    • 1970-01-01
    • 2021-09-08
    相关资源
    最近更新 更多