Environment
Environments define the different domains your Functions and Assets are available under. You can have one environment, or you can have many, e.g., a dev, stage, and prod. You can deploy a Build to any of your Environments.
Resource properties
sid
type: SID<ZE>
The unique string that we created to identify the Environment resource.
Pattern:
^ZE[0-9a-fA-F]{32}$
service_sid
type: SID<ZS>
The SID of the Service that the Environment resource is associated with.
Pattern:
^ZS[0-9a-fA-F]{32}$
build_sid
type: SID<ZB>
The SID of the build deployed in the environment.
Pattern:
^ZB[0-9a-fA-F]{32}$
unique_name
type: string
A user-defined string that uniquely identifies the Environment resource.
domain_suffix
type: string
A URL-friendly name that represents the environment and forms part of the domain name.
domain_name
type: string
The domain name for all Functions and Assets deployed in the Environment, using the Service unique name, a randomly-generated Service suffix, and an optional Environment domain suffix.
date_created
type: string<date-time>
date_updated
type: string<date-time>
url
type: string<uri>
The absolute URL of the Environment resource.
links
type: object<uri-map>
The URLs of the Environment resource's nested resources.
POST https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments
URI parameters
ServiceSid
type: string
The SID of the Service to create the Environment resource under.
Request body parameters
UniqueName
type: stringRequired
A user-defined string that uniquely identifies the Environment resource. It can be a maximum of 100 characters.
DomainSuffix
type: string
A URL-friendly name that represents the environment and forms part of the domain name. It can be a maximum of 16 characters.
_11// Download the helper library from https://www.twilio.com/docs/node/install
_11// Find your Account SID and Auth Token at twilio.com/console
_11// and set the environment variables. See http://twil.io/secure
_11const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11const authToken = process.env.TWILIO_AUTH_TOKEN;
_11const client = require('twilio')(accountSid, authToken);
_11client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .create({domainSuffix: 'stage', uniqueName: 'staging'})
_11 .then(environment => console.log(environment.domainName));
_18 "sid": "ZE00000000000000000000000000000000",
_18 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18 "unique_name": "staging",
_18 "domain_suffix": "stage",
_18 "domain_name": "foobar-1234-stage.twil.io",
_18 "custom_domain_name": null,
_18 "date_created": "2018-11-10T20:00:00Z",
_18 "date_updated": "2018-11-10T20:00:00Z",
_18 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000",
_18 "variables": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables",
_18 "deployments": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Deployments",
_18 "logs": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Logs"
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{Sid}
URI parameters
ServiceSid
type: string
The SID of the Service to fetch the Environment resource from.
Sid
type: SID<ZE>
The SID of the Environment resource to fetch.
Pattern:
^ZE[0-9a-fA-F]{32}$
_11// Download the helper library from https://www.twilio.com/docs/node/install
_11// Find your Account SID and Auth Token at twilio.com/console
_11// and set the environment variables. See http://twil.io/secure
_11const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11const authToken = process.env.TWILIO_AUTH_TOKEN;
_11const client = require('twilio')(accountSid, authToken);
_11client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .then(environment => console.log(environment.uniqueName));
_18 "sid": "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18 "build_sid": "ZB00000000000000000000000000000000",
_18 "unique_name": "testing-environment",
_18 "domain_suffix": "testing",
_18 "domain_name": "foobar-1234-testing.twil.io",
_18 "custom_domain_name": null,
_18 "date_created": "2018-11-10T20:00:00Z",
_18 "date_updated": "2018-11-10T20:00:00Z",
_18 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000",
_18 "variables": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables",
_18 "deployments": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Deployments",
_18 "logs": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Logs"
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments
URI parameters
ServiceSid
type: string
The SID of the Service to read the Environment resources from.
PageSize
type: integer
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Page
type: integer
The page index. This value is simply for client state.
PageToken
type: string
The page token. This is provided by the API.
_11// Download the helper library from https://www.twilio.com/docs/node/install
_11// Find your Account SID and Auth Token at twilio.com/console
_11// and set the environment variables. See http://twil.io/secure
_11const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11const authToken = process.env.TWILIO_AUTH_TOKEN;
_11const client = require('twilio')(accountSid, authToken);
_11client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .then(environments => environments.forEach(e => console.log(e.sid)));
_12 "first_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments?PageSize=50&Page=0",
_12 "key": "environments",
_12 "next_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments?PageSize=50&Page=1",
_12 "previous_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments?PageSize=50&Page=0",
_12 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments?PageSize=50&Page=0"
DELETE https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{Sid}
URI parameters
ServiceSid
type: string
The SID of the Service to delete the Environment resource from.
Sid
type: SID<ZE>
The SID of the Environment resource to delete.
Pattern:
^ZE[0-9a-fA-F]{32}$
_10// Download the helper library from https://www.twilio.com/docs/node/install
_10// Find your Account SID and Auth Token at twilio.com/console
_10// and set the environment variables. See http://twil.io/secure
_10const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10const authToken = process.env.TWILIO_AUTH_TOKEN;
_10const client = require('twilio')(accountSid, authToken);
_10client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10 .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')