How to ping the GraphQL API

Using GraphiQL (Hasura Console) Local Only

You will need to have the Hasura Cluster up and running, but once you do you only have to run these two commands:

$ ./hasura-cluster start
$ ./hasura-cluster console

There is a video on how to set up the Hasura cluster.

Sample Output

$ ./hasura-cluster start
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██░██░█░▄▄▀█░▄▄█░██░█░▄▄▀█░▄▄▀████░▄▄▀█░██░██░█░▄▄█▄░▄█░▄▄█░▄▄▀████░█▀▄██▄██▄░▄██
██░▄▄░█░▀▀░█▄▄▀█░██░█░▀▀▄█░▀▀░████░████░██░██░█▄▄▀██░██░▄▄█░▀▀▄████░▄▀███░▄██░███
██░██░█▄██▄█▄▄▄██▄▄▄█▄█▄▄█▄██▄████░▀▀▄█▄▄██▄▄▄█▄▄▄██▄██▄▄▄█▄█▄▄████░██░█▄▄▄██▄███
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Copyright © 1985 Data & Tech Services Corp.              Hasura Cluster:  start 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Creating network "moped-database_default" with the default driver
Creating volume "moped-database_moped-db-vol" with local driver
Creating moped-database_moped-pgsql_1 ... done
Creating moped-database_hasura_1      ... done
Checking the Hasura server is ready...
[λ] Hasura server ready!                    ✅?
--------------------------------------------------------------------
 ♻️  MIGRATIONS STARTED
--------------------------------------------------------------------
INFO migrations applied                           
INFO Metadata applied                             
INFO Seeds planted                                
--------------------------------------------------------------------
 Migrations Finished! 


--------------------------------------------------------------------
 ⛅️  Hasura Server Status
--------------------------------------------------------------------
 Status: ✅ OK
 Version: {"version":"v1.3.2"}
 You may run 'hasura console' now!
--------------------------------------------------------------------

$   ./hasura-cluster console
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
██░██░█░▄▄▀█░▄▄█░██░█░▄▄▀█░▄▄▀████░▄▄▀█░██░██░█░▄▄█▄░▄█░▄▄█░▄▄▀████░█▀▄██▄██▄░▄██
██░▄▄░█░▀▀░█▄▄▀█░██░█░▀▀▄█░▀▀░████░████░██░██░█▄▄▀██░██░▄▄█░▀▀▄████░▄▀███░▄██░███
██░██░█▄██▄█▄▄▄██▄▄▄█▄█▄▄█▄██▄████░▀▀▄█▄▄██▄▄▄█▄▄▄██▄██▄▄▄█▄█▄▄████░██░█▄▄▄██▄███
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Copyright © 1985 Data & Tech Services Corp.              Hasura Cluster:  console 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Starting the Hasura Console... (press Ctrl+C to stop)
INFO console running at: http://localhost:9695/ 

Hasura Console

Using Postman (Staging and Production)

It is recommended that you use Postman to connect to staging and production and run GraphQL. First add a new query type POST, and add the GraphQL endpoint (for example `https://moped-graphql-staging.austinmobility.io/v1/graphql`), then go to Authorization and select Bearer Token, then add your token in the input field:

After that, you can now go to the Body section, and select GraphQL query type. On the left you will be able to provide a GraphQL query, and to the right you can provide any variables it needs:

Hasura Console with Staging or Production

This is not recommended, you should not be making changes directly to staging or production via the Hasura console. It is however possible, this requires you to change the config.yaml file in the moped-database folder to look a bit like this:

version: 2
endpoint: https://moped-graphql-staging.austinmobility.io
metadata_directory: metadata
admin_secret: <secret_here>
actions:
  kind: synchronous
  handler_webhook_baseurl: https://moped-graphql-staging.austinmobility.io

Please note that this is for documentation purposes only, you may take a look to staging or production, but under no circumstances you need to make changes directly to staging and production, this can cause the environments to be out of sync and break the migrations system, you would be in the hook for a serious headache and the users would be unable to use moped.

Last updated