Announcement: Breaking Changes - GraphQL API

We received a lot of feedback and love for the GraphqQL API. With respect to the responses, we have been iterating a lot on the API to improve the overall UX and design. The recent changes in the API introduce a bunch of breaking changes in the available queries. The following are the supported queries in the new revision.

schema-change-1-august.png

As you can see feed queries have been refactored into two root queries

  1. storiesFeed
  2. discussionsFeed

Both of these queries will accept a FeedType and page argument with page index starting from 0.

  enum FeedType {
    GLOBAL
    FOR_ME
    FEATURED
    RECENT
  }

Example:

  • Let's say we want to fetch the global feed. So, the new query will look like:
query{
  storiesFeed(type: GLOBAL, page: 1){
    title
  }
}
  • The query to fetch your personalised feed is similar, but make sure to provide the Authorization header.
query{
  storiesFeed(type: FOR_ME, page: 1){
    title
    type
  }
}
  • Queries for discussionsFeed are similar to storiesFeed. For example, a query to get the recent discussions will look something like this:
{
  discussionsFeed(type: RECENT, page: 2) {
    title
  }
}

Looking forward to hearing more from you folks. Please keep the amazing feedback coming and we are looking forward to making the APIs better.

Write your comment…

Be the first one to comment