producthunt-api icon indicating copy to clipboard operation
producthunt-api copied to clipboard

Unable to Query Non-Featured Posts

Open iwootten opened this issue 3 years ago • 0 comments

I'm unable to query the API for non-featured posts.

I can see the v2 docs state the posts object has a "featured" flag which:

  • "Select Posts that have been featured or not featured depending on given value."

I can see this issue has come up before in #140 for v1 of the API, but it appears as a query param on v2?

If I use it to make the following query, I only get featured posts returned.

Query

  posts(featured: false) {
    edges {
      	cursor
        node {
            id
            name
            featuredAt
            votesCount
            url
            website
        }
    }
  }
}

Response

{
  "data": {
    "posts": {
      "edges": [
        {
          "cursor": "MQ==",
          "node": {
            "id": "328701",
            "name": "ThreadStart",
            "featuredAt": "2022-02-02T08:01:00Z",
            "votesCount": 228,
            "url": "https://www.producthunt.com/posts/threadstart?utm_campaign=producthunt-api&utm_medium=api-v2&utm_source=Application%3A+PH+API+Explorer+%28ID%3A+9162%29",
            "website": "https://www.producthunt.com/r/83aacb8c60db4d?utm_campaign=producthunt-api&utm_medium=api-v2&utm_source=Application%3A+PH+API+Explorer+%28ID%3A+9162%29"
          }
        },
                {
          "cursor": "Mg==",
          "node": {
            "id": "329840",
            "name": "Beseda Share",
            "featuredAt": "2022-02-02T08:02:52Z",
            "votesCount": 193,
            "url": "https://www.producthunt.com/posts/beseda-share?utm_campaign=producthunt-api&utm_medium=api-v2&utm_source=Application%3A+PH+API+Explorer+%28ID%3A+9162%29",
            "website": "https://www.producthunt.com/r/5c6b34faad158b?utm_campaign=producthunt-api&utm_medium=api-v2&utm_source=Application%3A+PH+API+Explorer+%28ID%3A+9162%29"
          }
        },

iwootten avatar Feb 02 '22 12:02 iwootten