Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Function Version Content


The /Content endpoint for each FunctionVersion lets you retrieve the code.


FunctionVersionContent Properties

functionversioncontent-properties page anchor
Property nameTypePIIDescription
sidSID<ZN>
Not PII

The unique string that we created to identify the Function Version resource.

Pattern: ^ZN[0-9a-fA-F]{32}$Min length: 34Max length: 34

account_sidSID<AC>

The SID of the Account that created the Function Version resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

service_sidSID<ZS>

The SID of the Service that the Function Version resource is associated with.

Pattern: ^ZS[0-9a-fA-F]{32}$Min length: 34Max length: 34

function_sidSID<ZH>

The SID of the Function that is the parent of the Function Version.

Pattern: ^ZH[0-9a-fA-F]{32}$Min length: 34Max length: 34

contentstring

The content of the Function Version resource.


urlstring<uri>

Fetch a FunctionVersionContent resource

fetch-a-functionversioncontent-resource page anchor
GET https://serverless.twilio.com/v1/Services/{ServiceSid}/Functions/{FunctionSid}/Versions/{Sid}/Content

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
ServiceSidstringrequired

The SID of the Service to fetch the Function Version content from.


FunctionSidSID<ZH>required

The SID of the Function that is the parent of the Function Version content to fetch.

Pattern: ^ZH[0-9a-fA-F]{32}$Min length: 34Max length: 34

SidSID<ZN>required

The SID of the Function Version content to fetch.

Pattern: ^ZN[0-9a-fA-F]{32}$Min length: 34Max length: 34

Fetch a FunctionVersionContent

fetch-a-functionversioncontent page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_13
// Download the helper library from https://www.twilio.com/docs/node/install
_13
// Find your Account SID and Auth Token at twilio.com/console
_13
// and set the environment variables. See http://twil.io/secure
_13
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_13
const authToken = process.env.TWILIO_AUTH_TOKEN;
_13
const client = require('twilio')(accountSid, authToken);
_13
_13
client.serverless.v1.services('ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_13
.functions('ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_13
.functionVersions('ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_13
.functionVersionContent()
_13
.fetch()
_13
.then(function_version_content => console.log(function_version_content.sid));

Output

_13
{
_13
"sid": "ZNXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"service_sid": "ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"function_sid": "ZHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_13
"content": "exports.handler = function (context, event, callback) {
_13
const request = require(\"request\");
_13
return request(\"http://www.google.com\", function (error, response, body) {
_13
callback(null, response.statusCode);
_13
});
_13
};",
_13
"url": "https://serverless.twilio.com/v1/Services/ZSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Functions/ZH00000000000000000000000000000000/Versions/ZN00000000000000000000000000000000/Content"
_13
}


Rate this page: