DEV Community

Vladimir Novick for Hasura

Posted on

Hasura Explorer feature as part of the console or stand alone

If you've been working with Hasura you've probably seen that Hasura auto generates GraphQL API in specific manner. It gives you bunch of helper input types that you can use for ordering, comparison e.t.c. Sometimes writing the following mutation can be a process of docs lookup and trying out things. That's why we've integrated an Explorer built by awesome folks at OneGraph that will ease you query/mutations/subscriptions writing. You can check the OneGraph explorer here

So what does it do.

Consider the following mutation

mutation {
  insert_posts(objects: {
    text: "Some text", 
    title: "Fifth post", 
    user: {
      data: {
        firstName: "Vlad", 
        lastName: "Novick"
      }
    }
  }) {
    returning {
      text
      title
      timestamp
      id
      user {
        firstName
        address
        id
        lastName
      }
    }
  }
}

Enter fullscreen mode Exit fullscreen mode

If you are new to Hasura console and especially if you are not familiar with this particular GraphQL schema, writing something like this will mean looking up in GraphiQL tab in docs:

Instead of this Hasura has a new feature now called Explorer.

When you click on Explorer button you will get the following sidebar where you can easily select checkboxes of what you want to query/subscribe for or mutate and query/mutation/subscription will be written automatically for you

Important to note that this Explorer respects Hasura Access Control rules and if user is not permitted to see parts of the data he/she won't be able to see that fields in explorer.

We at Hasura also realized that this tool can be beneficial for ecosystem in general and so we also open sourced it as a tool, so you will be able to use Explorer feature even for your own custom GraphQL server including passing your custom headers for your GraphQL endpoint.
You can find it on github

Or check its online version, which is available here:
https://graphiql-online.com

This tool also supports custom headers that you can send to your GraphQL endpoint so make it easy also to explore graphql endpoints that use Authorization header.

Enjoy.

Top comments (0)