Working with Hasura Data APIs using Postman

About APIs..

Data API is a service that links the user and database. It makes a request on behalf of user and it interacts with the API server to perform the required tasks with the data.

Understand more with this simple video by MuleSoft Videos:


When working with Hasura Development tool, it automatically creates some HTTP Data APIs for us to interact with the built-in Postgres database. This happens while we create tables in the schema section.

To build and test API requests I have used Postman. Postman is a free app for faster and easiar API development.The API request is made by writing queries in JSON. Hasura documentation provides much details on its further use.

The link to my data modelling blog is:

You can refer this to understand the tables and its attributes.

Here I will show how I made some basic API requests to perform operations like selection and insertion of data.

API request to select data

In the below screenshot, i have written a query to select data from my table which I created in my Hasura project console.The API was automatically created by Hasura and can be viewed in the Manage tab.Using this HTTP API I head to postman window to perform certain API requests and notice the response. The body is written in raw json format.

Remember that it is possible for User to select and display data only if the permission is granted to do that . These permissions can be managed in the Hasura console.

Insert API request

Similarly, Here I have illustrated the insert query to add attributes to my table back i my Hasura project console.

And we can see the insertions in our project console…

This is how we use our Hasura Data APIs with Postman to implement CRUD operations.