Read and write to REST-enabled databases


Once development teams begin using Postman to test their APIs, a logical follow-up question is how Postman can interact with databases. Postman can interact with any available HTTP endpoint, including REST-enabled database endpoints. Instead of querying a database directly, developers and testers use Postman to read and write to a database via a REST API.

Why would you want to do this? During development when you’re working with a local version of your database, you can use Postman to read and write to your database and make assertions about those responses. In this manner, you can test the internal state of your database that isn’t exposed by your API. Furthermore, using Postman can be a faster way to learn and use the database for someone who’s unfamiliar with SQL.

There are 2 ways to access your database using Postman:

  1. You can start a local database server, use scripts in Postman to build a request to send to that server, and log entries in a local instance of a database, kind of like how you would write to your local file system.
  2. Additionally, many database providers, like MySQL, MS SQL, and Mongo, provide an HTTP API to access their databases.

In this example, we’ll take the second approach, walk through how to set up a database using, and then access the database using Postman.

Setting up the database in

In their quick start guide, walks through setting up a database, creating a collection (an abstraction similar to a database table), and adding fields to the collection.

Once our database is set up, we will have a unique URL as its main access point, such as https://example-5a1e.restdb.iothat we’ll need for the next step.

In this example, I’ve created a collection called contact and entered some records containing fields like name, email, and photo.

Setting up Postman to hit the database

In the Postman app, enter the URL from the previous step into the request builder. If you’re going to be switching between with different server environments or databases, consider swapping out path elements for environment variables using a double curly brace syntax. The full URL should look something like this: <main-access-point>/rest/<collection-name>.

Under the Headers tab, specify your Content-Type as application/json.

Still under the Headers tab, add your x-apikey along with the value of your key from their Users and Settings page for the database. In Postman, you can paste the key directly in the field, or store it as an environment variable like we did in the first step.

Read, Write, and Test

Now, Postman is ready to send a request to your database. Hit Send and inspect the database API’s response.

Just like testing your API to ensure responses are successful and as we would expect, we can add some tests to make assertions about your database responses as well.

For example, if we added a new field called active, but didn’t plan to expose it to our users via API, we could test if this new field exists with a database query using Postman.



Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

7 thoughts on “Read and write to REST-enabled databases

  • Avatar

    Great post!
    I would like to send a request to sql server. Does anybody know how to get the url access point of a table in that application? please.
    Thanks in advance

  • Avatar


    we are going to use postman for api automating our apis..I need help how to validate api response against our data base..Can you guys guideline how to do that..

    • Avatar

      There are quite a few ways to achieve this! Please post on the community forum with more details about your use case so someone can help:

  • Avatar

    That was a nice post.Could you help me with steps of generating the urls for GET,POST,DELETE .Thanks!

  • Avatar

    Can we abe to fetch entire database at a time?

  • Avatar

    Fabulous! Well said.
    This was passed on to me by a colleague one notch up leadership from me. I know he has heard me question but this article really put it into perspective.

  • Avatar

    Hi Joyce, I have this kind of setup with XANO but my latency is really high when calling the database in my flow. Are there a best practice to update an internal database inside Postman I could use inside my flows. So I would have one flow updating internal database and another flow that would use the data ?