Asset
Assets are static files that you can host at a particular domain in an Environment.
The steps to create Assets are as follows:
-
Create an Asset (this resource)
-
Create an
Asset Version
We will need the Asset Version SID to include this Asset in a Build.
Resource properties
sid
type: SID<ZH>
The unique string that we created to identify the Asset resource.
Pattern:
^ZH[0-9a-fA-F]{32}$
service_sid
type: SID<ZS>
The SID of the Service that the Asset resource is associated with.
Pattern:
^ZS[0-9a-fA-F]{32}$
friendly_name
type: string
The string that you assigned to describe the Asset resource. It can be a maximum of 255 characters.
date_created
type: string<date-time>
date_updated
type: string<date-time>
url
type: string<uri>
The absolute URL of the Asset resource.
links
type: object<uri-map>
The URLs of the Asset resource's nested resources.
POST https://serverless.twilio.com/v1/Services/{ServiceSid}/Assets
URI parameters
ServiceSid
type: string
The SID of the Service to create the Asset resource under.
Request body parameters
FriendlyName
type: stringRequired
A descriptive string that you create to describe the Asset resource. It can be a maximum of 255 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({friendlyName: 'friendly_name'})
_11 .then(asset => console.log(asset.sid));
_12 "sid": "ZH00000000000000000000000000000000",
_12 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12 "friendly_name": "asset-friendly",
_12 "date_created": "2018-11-10T20:00:00Z",
_12 "date_updated": "2018-11-10T20:00:00Z",
_12 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets/ZH00000000000000000000000000000000",
_12 "asset_versions": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets/ZH00000000000000000000000000000000/Versions"
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Assets/{Sid}
URI parameters
ServiceSid
type: string
The SID of the Service to fetch the Asset resource from.
Sid
type: SID<ZH>
The SID that identifies the Asset resource to fetch.
Pattern:
^ZH[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 .assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .then(asset => console.log(asset.friendlyName));
_12 "sid": "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12 "friendly_name": "test-asset",
_12 "date_created": "2018-11-10T20:00:00Z",
_12 "date_updated": "2018-11-10T20:00:00Z",
_12 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets/ZH00000000000000000000000000000000",
_12 "asset_versions": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets/ZH00000000000000000000000000000000/Versions"
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Assets
URI parameters
ServiceSid
type: string
The SID of the Service to read the Asset 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(assets => assets.forEach(a => console.log(a.sid)));
_12 "first_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets?PageSize=50&Page=0",
_12 "next_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets?PageSize=50&Page=1",
_12 "previous_page_url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets?PageSize=50&Page=0",
_12 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets?PageSize=50&Page=0"
POST https://serverless.twilio.com/v1/Services/{ServiceSid}/Assets/{Sid}
URI parameters
ServiceSid
type: string
The SID of the Service to update the Asset resource from.
Sid
type: SID<ZH>
The SID that identifies the Asset resource to update.
Pattern:
^ZH[0-9a-fA-F]{32}$
Request body parameters
FriendlyName
type: stringRequired
A descriptive string that you create to describe the Asset resource. It can be a maximum of 255 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 .assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_11 .update({friendlyName: 'friendly_name'})
_11 .then(asset => console.log(asset.friendlyName));
_12 "sid": "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12 "account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12 "service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_12 "friendly_name": "asset-friendly-update",
_12 "date_created": "2018-11-10T20:00:00Z",
_12 "date_updated": "2018-11-10T20:00:00Z",
_12 "url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets/ZH00000000000000000000000000000000",
_12 "asset_versions": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Assets/ZH00000000000000000000000000000000/Versions"
DELETE https://serverless.twilio.com/v1/Services/{ServiceSid}/Assets/{Sid}
URI parameters
ServiceSid
type: string
The SID of the Service to delete the Asset resource from.
Sid
type: SID<ZH>
The SID that identifies the Asset resource to delete.
Pattern:
^ZH[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 .assets('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')