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

_21
// Download the helper library from https://www.twilio.com/docs/node/install
_21
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_21
_21
// Find your Account SID and Auth Token at twilio.com/console
_21
// and set the environment variables. See http://twil.io/secure
_21
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_21
const authToken = process.env.TWILIO_AUTH_TOKEN;
_21
const client = twilio(accountSid, authToken);
_21
_21
async function fetchFunctionVersionContent() {
_21
const functionVersionContent = await client.serverless.v1
_21
.services("ServiceSid")
_21
.functions("ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_21
.functionVersions("ZNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_21
.functionVersionContent()
_21
.fetch();
_21
_21
console.log(functionVersionContent.sid);
_21
}
_21
_21
fetchFunctionVersionContent();

Output

_10
{
_10
"sid": "ZNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"service_sid": "ServiceSid",
_10
"function_sid": "ZHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"content": "exports.handler = function (context, event, callback) {\n const request = require(\"request\");\n return request(\"http://www.google.com\", function (error, response, body) {\n callback(null, response.statusCode);\n });\n};",
_10
"url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions/ZH00000000000000000000000000000000/Versions/ZN00000000000000000000000000000000/Content"
_10
}


Rate this page: