Skip to main content

Importing Postman Collections, Variables, and Environments

If you have a Postman API Collection, you can import it directly into API Testing on Sauce Labs and use it to generate tests.

What You'll Need

note

Looking to import from a spec file? See Building a Test from a Spec File.

Importing Postman Collections

  1. Log in to Sauce Labs, then click API Testing.
  2. Click to open one of your Projects.
  3. Click the HTTP Client tab.
    HTTP Client
  4. Click Import OpenAPI/Postman, then Import OpenAPI/Postman Collection/.har and then, select and upload your Postman Collection file from your local machine.
    Import OpenAPI / Postman button
tip

If you don't have a file available, try out the sample below.

Click here to open a sample Postman Collection file
Copy the text below, paste the text into a text editor, then save that as a .json file.

demo_postman_collection.json
{
"info": {
"_postman_id": "901ae894-37d4-45c1-b1bc-bd6b31762bfe",
"name": "demoapif",
"description": "Call to the APIF demo API All Products Get.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "product",
"item": [
{
"name": "List All Products",
"request": {
"auth": {
"type": "oauth2",
"oauth2": [
{
"key": "addTokenTo",
"value": "header",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "Accept",
"value": "application/json"
},
{
"key": "key",
"value": "ABC123",
"type": "text"
}
],
"url": {
"raw": "http://demoapi.apifortress.com/api/retail/product",
"protocol": "http",
"host": [
"demoapi",
"apifortress",
"com"
],
"path": [
"api",
"retail",
"product"
]
}
},
"response": []
}
],
"description": "Folder for product"
}
]
}
  1. Click the folder in your Snapshots tree where you'd like to save your file.
    Routes Rendered
  2. Click Save.
    Import file to Project
  3. The routes from your collection will now show in the list of saved requests.
    Import file to Project

Importing Postman Environments

Postman Environments can be imported in both (Company/Project) Vault and Environments. Let's see how to do this in both cases:

Importing in Company/Project Vault

If you want to import in the Company Vault:

  1. Log in to Sauce Labs, then click API Testing.
  2. Click the Company Vault tab.
    Company Vault
  3. Click Import from the Variables section.
  4. Select and upload your .postman_environment.json file.

Your environmental variables will now be available across all your Projects.

If you want to import in the Project Vault:

  1. Log in to Sauce Labs, then click API Testing.
  2. Click to open one of your Projects.
  3. Click the Vault tab.
    Project Vault
  4. Click Import from the Variables section.
  5. Select and upload your .postman_environment.json file.

Your environmental variables will now be available in your Project.

Importing in Environments

  1. Log in to Sauce Labs, then click API Testing.
  2. Click to open one of your Projects.
  3. Click the Environments tab.
    Environments
  4. Click Import.
  5. Select and upload your .postman_environment.json file.

Your environmental variables will now be available as an Environment in your Project.

More Information