App Store Connect API:关系需要数据作为数组,但给出了一个对象

App Store Connect API: The relationship expects data as an array but an object was given

尝试使用 App Store Connect API 将构建添加到特定的 TestFlight beta 组。这是我尝试访问的端点:

POST https://api.appstoreconnect.apple.com/v1/builds/{id}/relationships/betaGroups

文档:https://developer.apple.com/documentation/appstoreconnectapi/add_access_for_beta_groups_to_a_build

我 运行 对我的请求正文有疑问。我当前的结构是:

{
    "data": {
        "type": "betaGroups",
        "id": "[group id]"
    }
}

我收到错误输出。

{
    "errors": [
        {
            "id": "c7bc3b27-3ce5-49c9-8e1e-e3ff80bd2b15",
            "status": "409",
            "code": "ENTITY_ERROR.RELATIONSHIP.INVALID",
            "title": "The provided relationships data has an invalid value",
            "detail": "The relationship expects data as an array but an object was given.",
            "source": {
                "pointer": "/data"
            }
        }
    ]
}

我从消息中得知某些东西必须是数组,但我不确定是什么。我已尝试阅读 api 文档,但充其量信息似乎很少,因此非常感谢你们提供的任何帮助。

谢谢

找到了我自己的问题的解决方案!!

使用这个 link (https://medium.com/xcblog/wwdc18-a-basic-guide-to-app-store-connect-api-366208651ac6) 我发布的请求正文必须是:

{
    "data": [{
        "type": "betaGroups",
        "id": "[group id]"
    }]
}