Variable
Variables are key/value pairs that you can add to a specific Environment . Use these for storing configuration like API keys rather than hardcoding them into your Functions . Environment Variables are encrypted, so they are the preferred way to store API keys, passwords, and any other secrets that your Function needs to use.
Resource properties The unique string that we created to identify the Variable resource.
The SID of the Service that the Variable resource is associated with.
environment_sid
type: SID<ZE> Not PIIThe SID of the Environment in which the Variable exists.
A string by which the Variable resource can be referenced.
A string that contains the actual value of the Variable.
date_created
type: string<DATE TIME> Not PIIdate_updated
type: string<DATE TIME> Not PIIThe absolute URL of the Variable resource.
POST https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables
URI parameters Path Parameter
The SID of the Service to create the Variable resource under.
Path Parameter
The SID of the Environment in which the Variable resource exists.
Request body parameters Required
A string by which the Variable resource can be referenced. It can be a maximum of 128 characters.
Required
A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size.
_12 // Download the helper library from https://www.twilio.com/docs/node/install
_12 // Find your Account SID and Auth Token at twilio.com/console
_12 // and set the environment variables. See http://twil.io/secure
_12 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12 const authToken = process.env.TWILIO_AUTH_TOKEN;
_12 const client = require('twilio')(accountSid, authToken);
_12 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .create({key: 'key', value: 'value'})
_12 .then(variable => console.log(variable.sid));
_11 "sid": "ZV00000000000000000000000000000000",
_11 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "environment_sid": "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "value": "new-value",
_11 "date_created": "2018-11-10T20:00:00Z",
_11 "date_updated": "2018-11-10T20:00:00Z",
_11 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables/ZV00000000000000000000000000000000"
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}
URI parameters Path Parameter
The SID of the Service to fetch the Variable resource from.
Path Parameter
The SID of the Environment with the Variable resource to fetch.
Path Parameter
The SID of the Variable resource to fetch.
_12 // Download the helper library from https://www.twilio.com/docs/node/install
_12 // Find your Account SID and Auth Token at twilio.com/console
_12 // and set the environment variables. See http://twil.io/secure
_12 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12 const authToken = process.env.TWILIO_AUTH_TOKEN;
_12 const client = require('twilio')(accountSid, authToken);
_12 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .variables('ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .then(variable => console.log(variable.sid));
_11 "sid": "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "environment_sid": "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "value": "test-value",
_11 "date_created": "2018-11-10T20:00:00Z",
_11 "date_updated": "2018-11-10T20:00:00Z",
_11 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables/ZV00000000000000000000000000000000"
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables
URI parameters Path Parameter
The SID of the Service to read the Variable resources from.
Path Parameter
The SID of the Environment with the Variable resources to read.
Query Parameter
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Query Parameter
The page index. This value is simply for client state.
Query Parameter
The page token. This is provided by the API.
_12 // Download the helper library from https://www.twilio.com/docs/node/install
_12 // Find your Account SID and Auth Token at twilio.com/console
_12 // and set the environment variables. See http://twil.io/secure
_12 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12 const authToken = process.env.TWILIO_AUTH_TOKEN;
_12 const client = require('twilio')(accountSid, authToken);
_12 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .then(variables => variables.forEach(v => console.log(v.sid)));
_12 "first_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables?PageSize=50&Page=0",
_12 "next_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables?PageSize=50&Page=1",
_12 "previous_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables?PageSize=50&Page=0",
_12 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables?PageSize=50&Page=0"
POST https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}
URI parameters Path Parameter
The SID of the Service to update the Variable resource under.
Path Parameter
The SID of the Environment with the Variable resource to update.
Path Parameter
The SID of the Variable resource to update.
Request body parameters A string by which the Variable resource can be referenced. It can be a maximum of 128 characters.
A string that contains the actual value of the Variable. It can be a maximum of 450 bytes in size.
_12 // Download the helper library from https://www.twilio.com/docs/node/install
_12 // Find your Account SID and Auth Token at twilio.com/console
_12 // and set the environment variables. See http://twil.io/secure
_12 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_12 const authToken = process.env.TWILIO_AUTH_TOKEN;
_12 const client = require('twilio')(accountSid, authToken);
_12 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .variables('ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_12 .update({key: 'key'})
_12 .then(variable => console.log(variable.sid));
_11 "sid": "ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "environment_sid": "ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11 "value": "update-value",
_11 "date_created": "2018-11-10T20:00:00Z",
_11 "date_updated": "2018-11-11T20:00:00Z",
_11 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Environments/ZE00000000000000000000000000000000/Variables/ZV00000000000000000000000000000000"
DELETE https://serverless.twilio.com/v1/Services/{ServiceSid}/Environments/{EnvironmentSid}/Variables/{Sid}
URI parameters Path Parameter
The SID of the Service to delete the Variable resource from.
Path Parameter
The SID of the Environment with the Variables to delete.
Path Parameter
The SID of the Variable resource to delete.
_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
_11 const accountSid = process.env.TWILIO_ACCOUNT_SID;
_11 const authToken = process.env.TWILIO_AUTH_TOKEN;
_11 const client = require('twilio')(accountSid, authToken);
_11 client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .environments('ZEXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .variables('ZVXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')