Create a data request in Postman
Use Postman’s data client to connect to a data source and query it directly. You can connect to a database, such as PostgreSQL or MySQL, or to a local or remote file. You can then explore the source’s structure and run queries against it without leaving Postman.
Data requests are available in the Postman desktop app, and in the web app with the Postman Desktop Agent active. Connecting to a local file is available only in the desktop app.
Connect to a data source
-
In the sidebar, click
and select Data.
-
Click the address bar and select the type of data source you want to connect to:
- For Local file, choose the file from your computer.
- For Remote file, enter the file’s URL.
- For MySQL or PostgreSQL, enter a connection string. For example,
<scheme>://<username>:<password>@<host>:<port>/<database>, where<scheme>is the database type such aspostgresqlormysql. Postman flags any fields that are missing or incorrectly formatted.
-
(Optional) For a database, you can enter the username and password in the Authorization tab instead of including them in the connection string.
Query a data source
-
In the schema explorer on the left side of the Query tab, browse and search the data source’s structure, such as its tables and columns.
-
Build your query. You can select an item in the schema explorer to add it to the query, or enter your query in the editor on the right side of the Query tab. The editor provides autocomplete, error highlighting, and formatting for SQL, including when you query a CSV as if it were a SQL table.
-
(Optional) To prevent the request from running SQL that writes data or changes the schema, such as
INSERT,UPDATE,DELETE,CREATE,ALTER, orDROP, open the Settings tab and turn on Read-only. -
Click Run to run the query. The results display in a table on the View tab, where you can sort, search, and page through the returned data. Postman also shows the number of rows returned and how long the query took.
You can keep multiple queries in the editor, separated by new lines or semicolons. Postman runs only the query where your cursor is focused, one at a time.
-
(Optional) Click Save to save the data request to a collection so you can reuse it later.