奇怪的Google Play Batch IAP API错误

时间:2017-08-10 23:08:34

标签: android json in-app-purchase google-play-developer-api

根据Google Play Developer API的文档,我应该可以批量插入或更新请求。但是,我遇到的问题似乎是文档错误,API被破坏,或者我只是遗漏了一些东西。

POST访问了网址:https://www.googleapis.com/androidpublisher/v2/applications/inappproducts/batch?access_token=<my token here>&autoConvertMissingPrices=true' My内容类型is set to:应用程序/ json And the body of my POST`如下:

{
    "entrys": [{
        "batchId": "<my batch id>",
        "methodName": "update",
        "inappproductsupdaterequest": {
            "inappproduct": {
                "packageName": "<my package name>",
                "sku": "<my product sku>",
                "status": "active",
                "purchaseType": "managedUser",
                "defaultPrice": {
                    "priceMicros": "<my price>",
                    "currency": "USD"
                },
                "listings": {
                    "en-US": {
                        "title": "<my title> ",
                        "description": "<my description>"
                    }
                },
                "defaultLanguage": "en-US"
            }
        }
    }]
}

当我POST时,我收到以下错误:

{
    "error": {
        "errors": [
            {
                "domain": "global",
                "reason": "required",
                "message": "Required parameter: [entry[0].inappproductsUpdateRequest.package_name]",
                "locationType": "parameter",
                "location": "[entry[0].inappproductsUpdateRequest.package_name]"
            }
        ],
        "code": 400,
        "message": "Required parameter: [entry[0].inappproductsUpdateRequest.package_name]"
    }
}

如果我正确阅读,他们希望将包名称参数作为inappproductsUpdateRequest下的子元素。但是,当我尝试在"packageName": "<my package name>"下作为孩子移动或复制(试过两个)inappproductsUpdateRequest时,我收到错误:

{
    "error": {
        "errors": [
            {
                "domain": "global",
                "reason": "invalid",
                "message": "Unknown field name: packageName",
                "locationType": "other",
                "location": "entrys.inappproductsupdaterequest"
            }
        ],
        "code": 400,
        "message": "Unknown field name: packageName"
    }
}

当我尝试package_name而不是packageName时,我收到了同样的错误。

有什么想法吗?

1 个答案:

答案 0 :(得分:0)

您是否尝试过响应显示的请求大约inappproductsUpdateRequest?我猜你确实需要package_name而不是packageName上的蛇案,但你可能也需要在那里尝试。