当使用Postman向Patreon API发出请求时,如何添加'fields'数组参数?

m3eecexj  于 2022-12-29  发布在  Postman
关注(0)|答案(1)|浏览(136)

我目前正在学习如何使用Patreon API。在我将其集成到我的站点之前,我想使用POSTMAN测试端点。例如,我想基于此文档测试/campaign端点。
但是,我对如何设置参数感到困惑

fields[campaign]=created_at,creation_name

我把它放在bodyx-www-form-urlencoded中,但它没有显示在属性中。
正确的设置方法是什么?
下面是我的截图 Postman :

根据文档,响应中的属性应包含以下信息:

{
    "data":
        {
            "attributes": {
                "created_at": "2018-04-01T15:27:11+00:00",
                "creation_name": "online communities",
                "discord_server_id": "1234567890",
                "image_small_url": "https://example.url",
                "image_url": "https://example.url",
                "is_charged_immediately": false,
                "is_monthly": true,
                "main_video_embed": null,
                "main_video_url": null,
                "one_liner": null,
                "patron_count": 1000,
                "pay_per_name": "month",
                "pledge_url": "/bePatron?c=12345",
                "published_at": "2018-04-01T18:15:34+00:00",
                "summary": "The most creator-first API",
                "thanks_embed": "",
                "thanks_msg": null,
                "thanks_video_url": null,
            },
           "id": "12345",
           "type": "campaign"
        },
lg40wkob

lg40wkob1#

来自API文档

GET /api/oauth2/v2/campaigns/{campaign_id}

[]需要URL编码

Fields for each include must be explicitly requested i.e. fields[campaign]=created_at,creation_name but url encode the brackets i.e.fields%5Bcampaign%5D=created_at,creation_name


因此,您需要更改查询参数KEY,但
值保持相同的格式field,field

fields[Bcampaign]

fields%5Bcampaign%5D

相关问题