# Query posts with API v2 endpoint

**URL:** <https://www.patreondevelopers.com/t/query-posts-with-api-v2-endpoint/5785>\
**Category:** Uncategorized\
**Created:** [July 14, 2022, 12:12am UTC](https://www.patreondevelopers.com/t/query-posts-with-api-v2-endpoint/5785 "2022-07-14T00:12:54Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chockenberry](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/chockenberry/32/2055_2.png) [@chockenberry](https://www.patreondevelopers.com/u/chockenberry)\
**Post date:** [July 14, 2022, 12:12am UTC](https://www.patreondevelopers.com/t/query-posts-with-api-v2-endpoint/5785/1 "2022-07-14T00:12:54Z")

</div>

I’m trying to retrieve posts from our creator account using the following endpoint:

`https://www.patreon.com/api/oauth2/v2/posts/<post_id>`

This works fine and I get the following payload:

```auto
{
   "data" : {
      "attributes" : {},
      "id" : "<post_id>",
      "type" : "post"
   },
   "links" : {
      "self" : "https://www.patreon.com/api/oauth2/v2/posts/<post_id>"
   }
}

```

The problem is when I try to get other fields from this endpoint. Since the documentation is lacking, I’m basing my requests on the code I see in the WordPress plug-in. In `patreon_api_v2.php`, the `get_post` function shows that the fields are specified as:

> fields[post]=title,content,is\_paid,is\_public,published\_at,url,embed\_data,embed\_url,app\_id,app\_status

I’m URL encoding these parameters before adding them to the query string, but I’m still getting the bare payload without any title or content.

Am I doing something wrong here or is this API not working correctly?

-ch

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [July 14, 2022, 4:21pm UTC](https://www.patreondevelopers.com/t/query-posts-with-api-v2-endpoint/5785/2 "2022-07-14T16:21:53Z")

</div>

Can you post your exact call? You could also get all those as an include while querying posts endpoint to get the list of posts/

---

<div class="post-metadata">

**Author:** ![chockenberry](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/chockenberry/32/2055_2.png) [@chockenberry](https://www.patreondevelopers.com/u/chockenberry)\
**Post date:** [July 14, 2022, 6:44pm UTC](https://www.patreondevelopers.com/t/query-posts-with-api-v2-endpoint/5785/3 "2022-07-14T18:44:04Z")

</div>

Here is the command I’m using with `curl`:

```auto
curl --request GET --url https://www.patreon.com/api/oauth2/v2/posts/<post_id>?fields%5Bpost%5D%3Dtitle%2Ccontent%2Cis_paid%2Cis_public%2Cpublished_at%2Curl%2Cembed_data%2Cembed_url%2Capp_id%2Capp_status --header 'authorization: Bearer REDACTED'

```

The requested post was created by the user account used to create the Bearer token.

I also tried your suggestion of using an include parameter, but get an error when I try to use things like “post”, “campaign.posts”, “title”, etc.:

```auto
curl --request GET --url https://www.patreon.com/api/oauth2/v2/campaigns/<campaign_id>/posts?include=post --header 'authorization: Bearer REDACTED'

{
   "errors" : [
      {
         "code" : 1,
         "code_name" : "ParameterInvalidOnType",
         "detail" : "Invalid parameter for 'include' on type post: ['post'].",
         "id" : "eb075c1c-7386-54ba-b2f7-b053e8786c5a",
         "status" : "400",
         "title" : "Invalid value for parameter 'include'."
      }
   ]
}

```

Still stumped.

-ch

---

<div class="post-metadata">

**Author:** ![chockenberry](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/chockenberry/32/2055_2.png) [@chockenberry](https://www.patreondevelopers.com/u/chockenberry)\
**Post date:** [July 14, 2022, 6:52pm UTC](https://www.patreondevelopers.com/t/query-posts-with-api-v2-endpoint/5785/4 "2022-07-14T18:52:11Z")

</div>

I’m an idiot. I was URL encoding the “=” in the query string.

For anyone that stumbles across this thread, use a `curl` command like this:

```auto
curl --request GET --url 'https://www.patreon.com/api/oauth2/v2/posts/<post_id>?fields%5Bpost%5D=title%2Ccontent%2Cis_paid%2Cis_public%2Cpublished_at%2Curl%2Cembed_data%2Cembed_url%2Capp_id%2Capp_status' --header 'authorization: Bearer REDACTED'

```

-ch

---

<div class="post-metadata">

**Author:** ![chockenberry](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/chockenberry/32/2055_2.png) [@chockenberry](https://www.patreondevelopers.com/u/chockenberry)\
**Post date:** [July 14, 2022, 7:05pm UTC](https://www.patreondevelopers.com/t/query-posts-with-api-v2-endpoint/5785/5 "2022-07-14T19:05:07Z")

</div>

While I have your attention @codebard - is there a way to get the uploads and tags associated with the post?

-ch

---

<div class="post-metadata">

**Author:** ![codebard](https://yyz2.discourse-cdn.com/flex036/user_avatar/www.patreondevelopers.com/codebard/32/14_2.png) [@codebard](https://www.patreondevelopers.com/u/codebard)\
**Post date:** [July 15, 2022, 7:26pm UTC](https://www.patreondevelopers.com/t/query-posts-with-api-v2-endpoint/5785/6 "2022-07-15T19:26:39Z")

</div>

Currently the api does not support attachments and tags, so no. It may be a good addition though.
