Create Environment

POST https://api.getpostman.com/environments?workspace={{workspaceId}}

Create Environment

Creates an Environment within a Workspace.

Overview

Body tab

A sample body is added to the request that conforms to the following JSON schema

  • Environment — An object containing Environment information:
    • name — A string that contains the Environment's name.
    • values — An array that contains key/values for Environment Variables.

Pre-request Script tab

Sends a message to the Console that the Request is starting to create an Environment.

Tests tab

  1. Checks for a 200 HTTP response to confirm that the new Environment has been created.
  2. Parse the Response.
  3. Sets the new ID as the value for environmentUid Collection Variable.

Request Params

KeyDatatypeRequiredDescription
workspacestring

Request Body

{"environment"=>{"name"=>"Scaffolded Environment | {{today}}", "values"=>[{"key"=>"baseUrl", "value"=>"{{mockUrl}}"}]}}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring

RESPONSES

status: OK

{"environment":{"id":"f158266e-306b-4702-a2b9-e4ede7878b7a","name":"Sample Environment Name (required)","uid":"5665-f158266e-306b-4702-a2b9-e4ede7878b7a"}}