Create Shared Environment

Create a new test environment.

Note: There is a limit of 100 shared environments per bucket. The API call will fail once the limit is exceeded.

Create Test Environment

curl 'https://api.runscope.com/buckets/<bucket_key>/environments' \
	-X POST \
	-H 'Content-Type: application/json' \
    -H 'Authorization: Bearer <access_token>' \
	-d '{"auth": {"password":"password","username":"username","auth_type":"basic"},"emails": {"notify_all": false,"notify_on":"all","notify_threshold": null,"recipients": [{"email":"grace@example.com","name":"Grace Hopper","id":"4ee15ecc-7fe1-43cb-aa12-ef50420f2cf9"}]},"initial_variables": {"my_variable":"some value","one more":"values"},"integrations": [],"name":"Remote Settings","parent_environment_id": null,"preserve_cookies": false,"regions": ["us1","jp1"],"retry_on_failure": false,"stop_on_failure": false,"remote_agents": [{"name":"my-local-machine.runscope.com","uuid":"141d4dbc-1e41-401e-8067-6df18501e9ed"}],"script":"var a = \"asdf\";\nlog(\"OK\");","verify_ssl": true,"client_certificate":"","webhooks": ["http://api.example.com/webhook_reciever","https://yourapihere.com/post"]}'

The following JSON sample provides a more readable version of the content contained in the above curl example. This example represents the attributes and values contained in the -d flag of the curl example. See the example POST body for creating a Test Environment.

Create Test Environment
Sample POST Body (JSON) for Create Test Environment

{
    "auth": {
        "password": "password",
        "username": "username",
        "auth_type": "basic"
    },
    "emails": {
        "notify_all": false,
        "notify_on": "all",
        "notify_threshold": null,
        "recipients": [
            {
                "email": "grace@example.com",
                "name": "Grace Hopper",
                "id": "4ee15ecc-7fe1-43cb-aa12-ef50420f2cf9"
            }
        ]
    },
    "initial_variables": {
        "my_variable": "some value",
        "one more": "values"
    },
    "integrations": [],
    "name": "Remote Settings",
    "parent_environment_id": null,
    "preserve_cookies": false,
    "regions": [
        "us1",
        "jp1"
    ],
    "retry_on_failure": false,
    "stop_on_failure": false,
    "remote_agents": [
        {
            "name": "my-local-machine.runscope.com",
            "uuid": "141d4dbc-1e41-401e-8067-6df18501e9ed"
        }
    ],
    "script": "var a = \"asdf\";\nlog(\"OK\");",
    "verify_ssl": true,
    "client_certificate": "",
    "webhooks": [
        "http://api.example.com/webhook_reciever",
        "https://yourapihere.com/post"
    ]
}

Response201 CREATED

{
    "auth": {
        "password": "password",
        "username": "username",
        "auth_type": "basic"
    },
    "emails": {
        "notify_all": false,
        "notify_on": "all",
        "notify_threshold": null,
        "recipients": [
            {
                "email": "grace@example.com",
                "name": "Grace Hopper",
                "id": "4ee15ecc-7fe1-43cb-aa12-ef50420f2cf9"
            }
        ]
    },
    "initial_variables": {
        "my_variable": "some value",
        "one more": "values"
    },
    "integrations": [],
    "name": "Remote Settings",
    "parent_environment_id": null,
    "preserve_cookies": false,
    "regions": [
        "us1",
        "jp1"
    ],
    "retry_on_failure": false,
    "stop_on_failure": false,
    "remote_agents": [
        {
            "name": "my-local-machine.runscope.com",
            "uuid": "141d4dbc-1e41-401e-8067-6df18501e9ed"
        }
    ],
    "script": "var a = \"asdf\";\nlog(\"OK\");",
    "test_id": null,
    "id": "f8007150-0052-482c-9d52-c3ea4042e0f5",
    "verify_ssl": true,
    "client_certificate": "",
    "webhooks": [
        "http://api.example.com/webhook_reciever",
        "https://yourapihere.com/post"
    ]
}