Data formats

Postman can export and import collections, environments, globals and header presets as files and links.

Exporting and Importing Postman data

Postman can export and import the following formats as a file or generated URL. When you export a collection from the Postman app, the exported file is a JSON file. The file contains all data (and metadata) that is required by Postman to recreate the collection when imported back into Postman, or that is utilized by Newman to run the collection from the command line interface (CLI).

Collections

export collection

Postman can export collections in two formats - v1 and v2. Both Collection v1 and v2 download as JSON files; v2 is more versatile and the most-used choice. Learn more about the v1 and v2 formats.

select v1 or v2 format

Environments

Environments can be exported from the MANAGE ENVIRONMENTS modal, and imported here as well.

export environments

Data dumps

export all Postman data

From the Data tab of the SETTINGS modal, Postman allows you to export all collections, environments, globals and header presets into one JSON file. Postman does not export your history. You can import this data back into Postman.

Importing Postman data

Postman data can be imported from the Data tab of the SETTINGS modal, or using the Import button in the header toolbar. Import a collection, environment, data dump, curl command, or a RAML / WADL / Swagger (v1/v2) / Runscope file using the IMPORT modal.

import data

Importing cURL

Most valid cURL (HTTP-only) commands can be imported into Postman. Postman’s importer supports the following cURL options:

Option**Description**-A, –user-agentAn optional user-agent string-d, –dataSends the specified data to the server with type application/x-www-form-urlencoded–data-asciiSends the specified data to the server with type application/x-www-form-urlencoded–data-urlencodeSends the specified data to the server with type application/x-www-form-urlencoded–data-binaryData sent as-is-F, –form A single form-data field (can be used multiple times)-G, –getForces the request to be sent as GET, with the –data parameters appended to the query string-H, –headerAdd a header (can be used multiple times)-X, –requestSpecify a custom request method to be used–urlAn alternate way to specify the URLA few commands which can be imported include:

cURL**Effect**curl http://postman-echo.com/getCreates a GET request in Postman with the URL prefilledcurl –request POST –url http://postman-echo.com/post –form color=red –form color=greenCreates a POST request with a multivalue form data rowcurl -X PUT –data-binary hello http://postman-echo.com/putCreates a POST request with raw datacurl -X PUT –data-ascii ‘a=b&c=d’ http://postman-echo.com/put -H ‘AccessToken:1234’Creates a PUT request with urlencoded form data, and a custom header

Importing RAML

Saving a RAML folder as a collection
  1. Clone the repository containing the RAML definition to your local machine, or save it locally as a folder.
  2. Click on the Import button, and choose the Import Folder tab.import button
  3. Click on Choose Folders and upload the RAML folder.import folder modal

You’re done! Postman will detect all the RAML definitions and convert them internally to Postman and then show you an import success message.

confirmation message

Examples

Download an example RAML file: github-api-v3.raml

Importing Swagger

A Swagger API definition usually lives as a single file, so we only support imports of single swagger files. If you have a lot of unrelated Swagger files in a folder, you can import those through the folder importer.

Saving a Swagger file as a collection
  1. Clone the repository containing the Swagger definition to your local machine. If you have it saved locally as file already, that’s fine of course.
  2. Click on the Import button, and choose the Import File tab. If you have a lot of unrelated Swagger files in a folder, you can import those through the folder importer. import button
  3. Click on file and upload the Swagger file.

You’re done! Postman will detect all the Swagger definitions and convert them internally to Postman and then show you an import success message.

confirmation message

Examples

Swagger 2.0: https://github.com/OAI/OpenAPI-Specification/tree/master/examples/v2.0

Swagger 1.2: https://github.com/OAI/OpenAPI-Specification/wiki/Hello-World-Sample

Importing WADL

Postman lets you import WADL specs too. While all aspects are not supported yet, you can expect the various parameters that Postman uses (collections, folder, requests, headers, request payloads) to be correctly generated. We’re currently working on extending this feature.

Example WADL file
<application xmlns="http://wadl.dev.java.net/2009/02">
  <resources base="http://example.com/api">
    <resource path="books">
      <method name="GET"/>
      <resource path="{bookId}">
        <param required="true" style="template" name="bookId"/>
        <method name="GET"/>
        <method name="DELETE"/>
        <resource path="reviews">
          <method name="GET">
            <request>
              <param name="page" required="false" default="1" style="query"/>
              <param name="size" required="false" default="20" style="query"/>
            </request>
          </method>
        </resource>
      </resource>
    </resource>
    <resource path="readers">
      <method name="GET"/>
    </resource>
  </resources>
</application>

Taken from http://www.nurkiewicz.com/2012/01/gentle-introduction-to-wadl-in-java.html

Validating Collection JSON files

To validate if a JSON file is in the correct collections format, you can use our schema files for collections.

results matching ""

    No results matching ""