const apiInstance = new Fastly.VclApi();
Note
All URIs are relative to https://api.fastly.com
Method | HTTP request | Description |
---|---|---|
createCustomVcl | POST /service/{service_id}/version/{version_id}/vcl | Create a custom VCL file |
deleteCustomVcl | DELETE /service/{service_id}/version/{version_id}/vcl/{vcl_name} | Delete a custom VCL file |
getCustomVcl | GET /service/{service_id}/version/{version_id}/vcl/{vcl_name} | Get a custom VCL file |
getCustomVclBoilerplate | GET /service/{service_id}/version/{version_id}/boilerplate | Get boilerplate VCL |
getCustomVclGenerated | GET /service/{service_id}/version/{version_id}/generated_vcl | Get the generated VCL for a service |
getCustomVclGeneratedHighlighted | GET /service/{service_id}/version/{version_id}/generated_vcl/content | Get the generated VCL with syntax highlighting |
getCustomVclHighlighted | GET /service/{service_id}/version/{version_id}/vcl/{vcl_name}/content | Get a custom VCL file with syntax highlighting |
getCustomVclRaw | GET /service/{service_id}/version/{version_id}/vcl/{vcl_name}/download | Download a custom VCL file |
lintVclDefault | POST /vcl_lint | Lint (validate) VCL using a default set of flags. |
lintVclForService | POST /service/{service_id}/lint | Lint (validate) VCL using flags set for the service. |
listCustomVcl | GET /service/{service_id}/version/{version_id}/vcl | List custom VCL files |
setCustomVclMain | PUT /service/{service_id}/version/{version_id}/vcl/{vcl_name}/main | Set a custom VCL file as main |
updateCustomVcl | PUT /service/{service_id}/version/{version_id}/vcl/{vcl_name} | Update a custom VCL file |
createCustomVcl({ service_id, version_id, [content, ][main, ][name] })
Upload a VCL for a particular service and version.
const options = {
service_id: "service_id_example", // required
version_id: 56, // required
content: "content_example",
main: true,
name: "name_example",
};
apiInstance.createCustomVcl(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
service_id | String | Alphanumeric string identifying the service. | |
version_id | Number | Integer identifying a service version. | |
content | String | The VCL code to be included. | [optional] |
main | Boolean | Set to true when this is the main VCL, otherwise false . |
[optional] |
name | String | The name of this VCL. | [optional] |
deleteCustomVcl({ service_id, version_id, vcl_name })
Delete the uploaded VCL for a particular service and version.
const options = {
service_id: "service_id_example", // required
version_id: 56, // required
vcl_name: "vcl_name_example", // required
};
apiInstance.deleteCustomVcl(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
service_id | String | Alphanumeric string identifying the service. | |
version_id | Number | Integer identifying a service version. | |
vcl_name | String | The name of this VCL. |
getCustomVcl({ service_id, version_id, vcl_name, [no_content] })
Get the uploaded VCL for a particular service and version.
const options = {
service_id: "service_id_example", // required
version_id: 56, // required
vcl_name: "vcl_name_example", // required
no_content: "'0'",
};
apiInstance.getCustomVcl(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
service_id | String | Alphanumeric string identifying the service. | |
version_id | Number | Integer identifying a service version. | |
vcl_name | String | The name of this VCL. | |
no_content | String | Omit VCL content. | [optional] [defaults to '0'] |
getCustomVclBoilerplate({ service_id, version_id })
Return boilerplate VCL with the service's TTL from the settings.
const options = {
service_id: "service_id_example", // required
version_id: 56, // required
};
apiInstance.getCustomVclBoilerplate(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
service_id | String | Alphanumeric string identifying the service. | |
version_id | Number | Integer identifying a service version. |
String
getCustomVclGenerated({ service_id, version_id })
Display the generated VCL for a particular service and version.
const options = {
service_id: "service_id_example", // required
version_id: 56, // required
};
apiInstance.getCustomVclGenerated(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
service_id | String | Alphanumeric string identifying the service. | |
version_id | Number | Integer identifying a service version. |
getCustomVclGeneratedHighlighted({ service_id, version_id })
Display the content of generated VCL with HTML syntax highlighting. Include line numbers by sending lineno=true
as a request parameter.
const options = {
service_id: "service_id_example", // required
version_id: 56, // required
};
apiInstance.getCustomVclGeneratedHighlighted(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
service_id | String | Alphanumeric string identifying the service. | |
version_id | Number | Integer identifying a service version. |
getCustomVclHighlighted({ service_id, version_id, vcl_name })
Get the uploaded VCL for a particular service and version with HTML syntax highlighting. Include line numbers by sending lineno=true
as a request parameter.
const options = {
service_id: "service_id_example", // required
version_id: 56, // required
vcl_name: "vcl_name_example", // required
};
apiInstance.getCustomVclHighlighted(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
service_id | String | Alphanumeric string identifying the service. | |
version_id | Number | Integer identifying a service version. | |
vcl_name | String | The name of this VCL. |
getCustomVclRaw({ service_id, version_id, vcl_name })
Download the specified VCL.
const options = {
service_id: "service_id_example", // required
version_id: 56, // required
vcl_name: "vcl_name_example", // required
};
apiInstance.getCustomVclRaw(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
service_id | String | Alphanumeric string identifying the service. | |
version_id | Number | Integer identifying a service version. | |
vcl_name | String | The name of this VCL. |
String
lintVclDefault({ inline_object1 })
This endpoint validates the submitted VCL against a default set of enabled flags. Consider using the /service/{service_id}/lint
operation to validate VCL in the context of a specific service.
const options = {
inline_object1: new Fastly.InlineObject1(), // required
};
apiInstance.lintVclDefault(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
inline_object1 | InlineObject1 |
lintVclForService({ service_id, inline_object })
Services may have flags set by a Fastly employee or by the purchase of products as addons to the service, which modify the way VCL is interpreted by that service. This endpoint validates the submitted VCL in the context of the specified service.
const options = {
service_id: "service_id_example", // required
inline_object: new Fastly.InlineObject(), // required
};
apiInstance.lintVclForService(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
service_id | String | Alphanumeric string identifying the service. | |
inline_object | InlineObject |
listCustomVcl({ service_id, version_id })
List the uploaded VCLs for a particular service and version.
const options = {
service_id: "service_id_example", // required
version_id: 56, // required
};
apiInstance.listCustomVcl(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
service_id | String | Alphanumeric string identifying the service. | |
version_id | Number | Integer identifying a service version. |
setCustomVclMain({ service_id, version_id, vcl_name })
Set the specified VCL as the main.
const options = {
service_id: "service_id_example", // required
version_id: 56, // required
vcl_name: "vcl_name_example", // required
};
apiInstance.setCustomVclMain(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
service_id | String | Alphanumeric string identifying the service. | |
version_id | Number | Integer identifying a service version. | |
vcl_name | String | The name of this VCL. |
updateCustomVcl({ service_id, version_id, vcl_name, [content, ][main, ][name] })
Update the uploaded VCL for a particular service and version.
const options = {
service_id: "service_id_example", // required
version_id: 56, // required
vcl_name: "vcl_name_example", // required
content: "content_example",
main: true,
name: "name_example",
};
apiInstance.updateCustomVcl(options)
.then((data) => {
console.log(data, "API called successfully.");
})
.catch((error) => {
console.error(error);
});
Name | Type | Description | Notes |
---|---|---|---|
service_id | String | Alphanumeric string identifying the service. | |
version_id | Number | Integer identifying a service version. | |
vcl_name | String | The name of this VCL. | |
content | String | The VCL code to be included. | [optional] |
main | Boolean | Set to true when this is the main VCL, otherwise false . |
[optional] |
name | String | The name of this VCL. | [optional] |