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
- Checks for a 200 HTTP response to confirm that the new Environment has been created.
- Parse the Response.
- Sets the new ID as the value for
environmentUid
Collection Variable.
Request Params
Key | Datatype | Required | Description |
---|---|---|---|
workspace | string |
Request Body
{"environment"=>{"name"=>"Scaffolded Environment | {{today}}", "values"=>[{"key"=>"baseUrl", "value"=>"{{mockUrl}}"}]}}
HEADERS
Key | Datatype | Required | Description |
---|---|---|---|
Content-Type | string |
RESPONSES
status: OK
{"environment":{"id":"f158266e-306b-4702-a2b9-e4ede7878b7a","name":"Sample Environment Name (required)","uid":"5665-f158266e-306b-4702-a2b9-e4ede7878b7a"}}