Search code examples
postmanpatreon

How do I add the `fields` array parameter when making requests to Patreon API using Postman?


I'm currently learning how to use the Patreon API. Before I integrate it into my site, I want to test the endpoints using POSTMAN. For example, I want to test the /campaign endpoint based on this documentation.

However, I'm confused how to set the parameter

fields[campaign]=created_at,creation_name

I put it in the body > x-www-form-urlencoded but it's not getting displayed in the atributes.

What is the correct way to set it?

Here is my screenshot of Postman:

patreonpostman

Based on the documentation, the attributes in the response should have this information:

{
    "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"
        },

Solution

  • From the API documentation

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

    [ and ] needs to URL encode

    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
    

    enter image description here So you needs to change the Query Params KEY but

    VALUE keep the same format field , field

    From

    fields[Bcampaign]
    

    To

    fields%5Bcampaign%5D
    

    enter image description here