Cloud CDN API, REST: Resource.Create
- HTTP request
- Body parameters
- Origin
- ResourceOriginParams
- OriginMeta
- OriginNamedMeta
- OriginBalancerMeta
- SecondaryHostnames
- ResourceOptions
- BoolOption
- EdgeCacheSettings
- CachingTimes
- Int64Option
- StringsListOption
- QueryParamsOptions
- CompressionOptions
- RedirectOptions
- HostOptions
- StringOption
- StringsMapOption
- RewriteOption
- SecureKeyOption
- IPAddressACLOption
- SSLTargetCertificate
- SSLCertificateData
- SSLCertificateCMData
- Response
- CreateResourceMetadata
- Status
- Resource
- ResourceOptions
- BoolOption
- EdgeCacheSettings
- CachingTimes
- Int64Option
- StringsListOption
- QueryParamsOptions
- CompressionOptions
- RedirectOptions
- HostOptions
- StringOption
- StringsMapOption
- RewriteOption
- SecureKeyOption
- IPAddressACLOption
- SSLCertificate
- SSLCertificateData
- SSLCertificateCMData
Creates a CDN resource in the specified folder.
Creation may take up to 15 minutes.
HTTP request
POST https://cdn.api.cloud.yandex.net/cdn/v1/resources
Body parameters
{
"folderId": "string",
"cname": "string",
"origin": {
// Includes only one of the fields `originGroupId`, `originSource`, `originSourceParams`
"originGroupId": "string",
"originSource": "string",
"originSourceParams": {
"source": "string",
"meta": {
// Includes only one of the fields `common`, `bucket`, `website`, `balancer`
"common": {
"name": "string"
},
"bucket": {
"name": "string"
},
"website": {
"name": "string"
},
"balancer": {
"id": "string"
}
// end of the list of possible fields
}
}
// end of the list of possible fields
},
"secondaryHostnames": {
"values": [
"string"
]
},
"originProtocol": "string",
"active": "boolean",
"options": {
"disableCache": {
"enabled": "boolean",
"value": "boolean"
},
"edgeCacheSettings": {
"enabled": "boolean",
// Includes only one of the fields `value`, `defaultValue`
"value": {
"simpleValue": "string",
"customValues": "string"
},
"defaultValue": "string"
// end of the list of possible fields
},
"browserCacheSettings": {
"enabled": "boolean",
"value": "string"
},
"cacheHttpHeaders": {
"enabled": "boolean",
"value": [
"string"
]
},
"queryParamsOptions": {
// Includes only one of the fields `ignoreQueryString`, `queryParamsWhitelist`, `queryParamsBlacklist`
"ignoreQueryString": {
"enabled": "boolean",
"value": "boolean"
},
"queryParamsWhitelist": {
"enabled": "boolean",
"value": [
"string"
]
},
"queryParamsBlacklist": {
"enabled": "boolean",
"value": [
"string"
]
}
// end of the list of possible fields
},
"slice": {
"enabled": "boolean",
"value": "boolean"
},
"compressionOptions": {
// Includes only one of the fields `fetchCompressed`, `gzipOn`, `brotliCompression`
"fetchCompressed": {
"enabled": "boolean",
"value": "boolean"
},
"gzipOn": {
"enabled": "boolean",
"value": "boolean"
},
"brotliCompression": {
"enabled": "boolean",
"value": [
"string"
]
}
// end of the list of possible fields
},
"redirectOptions": {
// Includes only one of the fields `redirectHttpToHttps`, `redirectHttpsToHttp`
"redirectHttpToHttps": {
"enabled": "boolean",
"value": "boolean"
},
"redirectHttpsToHttp": {
"enabled": "boolean",
"value": "boolean"
}
// end of the list of possible fields
},
"hostOptions": {
// Includes only one of the fields `host`, `forwardHostHeader`
"host": {
"enabled": "boolean",
"value": "string"
},
"forwardHostHeader": {
"enabled": "boolean",
"value": "boolean"
}
// end of the list of possible fields
},
"staticHeaders": {
"enabled": "boolean",
"value": "string"
},
"cors": {
"enabled": "boolean",
"value": [
"string"
]
},
"stale": {
"enabled": "boolean",
"value": [
"string"
]
},
"allowedHttpMethods": {
"enabled": "boolean",
"value": [
"string"
]
},
"proxyCacheMethodsSet": {
"enabled": "boolean",
"value": "boolean"
},
"disableProxyForceRanges": {
"enabled": "boolean",
"value": "boolean"
},
"staticRequestHeaders": {
"enabled": "boolean",
"value": "string"
},
"customServerName": {
"enabled": "boolean",
"value": "string"
},
"ignoreCookie": {
"enabled": "boolean",
"value": "boolean"
},
"rewrite": {
"enabled": "boolean",
"body": "string",
"flag": "string"
},
"secureKey": {
"enabled": "boolean",
"key": "string",
"type": "string"
},
"ipAddressAcl": {
"enabled": "boolean",
"policyType": "string",
"exceptedValues": [
"string"
]
}
},
"sslCertificate": {
"type": "string",
"data": {
// Includes only one of the fields `cm`
"cm": {
"id": "string"
}
// end of the list of possible fields
}
},
"labels": "string"
}
Field |
Description |
folderId |
string Required field. ID of the to bind with new resource. |
cname |
string Required field. CDN endpoint CNAME, must be unique among clients's resources. |
origin |
Required field. Specify the origins to be used for CDN resources requests. |
secondaryHostnames |
List of additional CNAMEs. |
originProtocol |
enum (OriginProtocol) Specify the protocol schema to be used in communication with origin.
|
active |
boolean Flag to create Resource either in active or disabled state. |
options |
Resource settings and options to tune CDN edge behavior. Most is unset. |
sslCertificate |
SSL Certificate options. |
labels |
string Labels of the resource. |
Origin
Field |
Description |
originGroupId |
string (int64) ID of pre-created origin group. Includes only one of the fields |
originSource |
string Create new Origins group with single source, it's id will be Includes only one of the fields |
originSourceParams |
Set up resource origin parameters. Includes only one of the fields |
ResourceOriginParams
A set of resource origin parameters.
Field |
Description |
source |
string Source of the content. |
meta |
Set up type of the origin. |
OriginMeta
Origin type. For details about the concept, see documentation.
Field |
Description |
common |
A server with a domain name linked to it Includes only one of the fields Type of the origin. |
bucket |
An Object Storage bucket not configured as a static site hosting. Includes only one of the fields Type of the origin. |
website |
An Object Storage bucket configured as a static site hosting. Includes only one of the fields Type of the origin. |
balancer |
An L7 load balancer from Application Load Balancer. Includes only one of the fields Type of the origin. |
OriginNamedMeta
Origin info. For details about the concept, see documentation.
Field |
Description |
name |
string Name of the origin. |
OriginBalancerMeta
Application Load Balancer origin info. For details about the concept, see documentation.
Field |
Description |
id |
string ID of the origin. |
SecondaryHostnames
List of secondary (alternative) CNAMEs.
Field |
Description |
values[] |
string List of secondary hostname values. |
ResourceOptions
A major set of various resource options.
Field |
Description |
disableCache |
Set up a cache status. |
edgeCacheSettings |
Set up EdgeCacheSettings. |
browserCacheSettings |
Using Int64Option. Set up a cache period for the end-users browser. |
cacheHttpHeaders |
List HTTP headers that must be included in responses to clients. |
queryParamsOptions |
Set up QueryParamsOptions. |
slice |
Files larger than 10 MB will be requested and cached in parts (no larger than 10 MB each part). It reduces time to first byte. The origin must support HTTP Range requests. By default the option is disabled. |
compressionOptions |
Set up compression variant. |
redirectOptions |
Set up redirects. |
hostOptions |
Set up host parameters. |
staticHeaders |
Set up static headers that CDN servers send in responses to clients. |
cors |
Parameter that lets browsers get access to selected resources from a domain |
stale |
List of errors which instruct CDN servers to serve stale content to clients. Possible values: |
allowedHttpMethods |
HTTP methods for your CDN content. By default the following methods |
proxyCacheMethodsSet |
Allows caching for GET, HEAD and POST requests. |
disableProxyForceRanges |
Disabling proxy force ranges. |
staticRequestHeaders |
Set up custom headers that CDN servers send in requests to origins. |
customServerName |
Wildcard additional CNAME. |
ignoreCookie |
Using BoolOption for ignoring cookie. |
rewrite |
Changing or redirecting query paths. |
secureKey |
Secure token to protect contect and limit access by IP addresses and time limits. |
ipAddressAcl |
Manage the state of the IP access policy option. |
BoolOption
Set up bool values.
Field |
Description |
enabled |
boolean True - the option is enabled and its |
value |
boolean Value of the option. |
EdgeCacheSettings
A set of the edge cache parameters.
Field |
Description |
enabled |
boolean True - the option is enabled and its |
value |
Value of the option. Includes only one of the fields |
defaultValue |
string (int64) Content will be cached according to origin cache settings. Includes only one of the fields |
CachingTimes
A set of the caching response time parameters.
Field |
Description |
simpleValue |
string (int64) Caching time for a response with codes 200, 206, 301, 302. |
customValues |
string (int64) Caching time for a response with specific codes. These settings have a higher priority than the value field. |
Int64Option
A set of the numeric parameters.
Field |
Description |
enabled |
boolean True - the option is enabled and its |
value |
string (int64) Value of the option. |
StringsListOption
A set of the string list parameters.
Field |
Description |
enabled |
boolean True - the option is enabled and its |
value[] |
string Value of the option. |
QueryParamsOptions
A set of the query parameters.
Field |
Description |
ignoreQueryString |
Using BoolOption. Selected by default. Files with different query parameters are cached as objects with the same key regardless of the parameter value. Includes only one of the fields |
queryParamsWhitelist |
Ignore All Except. Includes only one of the fields |
queryParamsBlacklist |
Ignore only. Files with the specified query parameters are cached as objects with the same key, Includes only one of the fields |
CompressionOptions
A set of the compression variant parameters.
Field |
Description |
fetchCompressed |
The Fetch compressed option helps you to reduce Includes only one of the fields |
gzipOn |
Using BoolOption. GZip compression at CDN servers reduces file size by 70% and can be as high as 90%. Includes only one of the fields |
brotliCompression |
The option allows to compress content with brotli on the CDN's end. Compression is performed on the Origin Shielding. If a pre-cache server doesn't active for a resource, compression does not occur even if the option is enabled. Specify the content-type for each type of content you wish to have compressed. CDN servers will request only uncompressed content from the origin. Includes only one of the fields |
RedirectOptions
A set of the redirect parameters.
Field |
Description |
redirectHttpToHttps |
Using BoolOption. Set up a redirect from HTTPS to HTTP. Includes only one of the fields |
redirectHttpsToHttp |
Using BoolOption. Set up a redirect from HTTP to HTTPS. Includes only one of the fields |
HostOptions
A set of the host parameters.
Field |
Description |
host |
Custom value for the Host header. Your server must be able to process requests with the chosen header. Default value (if StringOption.enabled is Includes only one of the fields |
forwardHostHeader |
Using BoolOption. Choose the Forward Host header option if is important to send in the request to the Origin Includes only one of the fields |
StringOption
A set of the string parameters.
Field |
Description |
enabled |
boolean True - the option is enabled and its |
value |
string Value of the option. |
StringsMapOption
A set of the strings map parameters.
Field |
Description |
enabled |
boolean True - the option is enabled and its |
value |
string Value of the option. |
RewriteOption
An option for changing or redirecting query paths.
Field |
Description |
enabled |
boolean True - the option is enabled and its |
body |
string Pattern for rewrite. The value must have the following format: |
flag |
enum (RewriteFlag) Break flag is applied to the option by default.
|
SecureKeyOption
Field |
Description |
enabled |
boolean True - the option is enabled and its flag is applied to the resource. |
key |
string The key for the URL signing. |
type |
enum (SecureKeyURLType) The type of the URL signing. The URL could be available for all IP addresses or for the only one IP.
|
IPAddressACLOption
Field |
Description |
enabled |
boolean True - the option is enabled and its flag is applied to the resource. |
policyType |
enum (PolicyType) The policy type. One of allow or deny value.
|
exceptedValues[] |
string The list of IP addresses to be allowed or denied. |
SSLTargetCertificate
A set of the personal SSL certificate parameters.
Field |
Description |
type |
enum (SSLCertificateType) Type of the certificate.
|
data |
Certificate data. |
SSLCertificateData
A certificate data parameters.
Field |
Description |
cm |
Custom (add your SSL certificate by uploading the certificate Includes only one of the fields |
SSLCertificateCMData
A certificate data custom parameters.
Field |
Description |
id |
string ID of the custom certificate. |
Response
HTTP Code: 200 - OK
{
"id": "string",
"description": "string",
"createdAt": "string",
"createdBy": "string",
"modifiedAt": "string",
"done": "boolean",
"metadata": {
"resourceId": "string"
},
// Includes only one of the fields `error`, `response`
"error": {
"code": "integer",
"message": "string",
"details": [
"object"
]
},
"response": {
"id": "string",
"folderId": "string",
"cname": "string",
"createdAt": "string",
"updatedAt": "string",
"active": "boolean",
"options": {
"disableCache": {
"enabled": "boolean",
"value": "boolean"
},
"edgeCacheSettings": {
"enabled": "boolean",
// Includes only one of the fields `value`, `defaultValue`
"value": {
"simpleValue": "string",
"customValues": "string"
},
"defaultValue": "string"
// end of the list of possible fields
},
"browserCacheSettings": {
"enabled": "boolean",
"value": "string"
},
"cacheHttpHeaders": {
"enabled": "boolean",
"value": [
"string"
]
},
"queryParamsOptions": {
// Includes only one of the fields `ignoreQueryString`, `queryParamsWhitelist`, `queryParamsBlacklist`
"ignoreQueryString": {
"enabled": "boolean",
"value": "boolean"
},
"queryParamsWhitelist": {
"enabled": "boolean",
"value": [
"string"
]
},
"queryParamsBlacklist": {
"enabled": "boolean",
"value": [
"string"
]
}
// end of the list of possible fields
},
"slice": {
"enabled": "boolean",
"value": "boolean"
},
"compressionOptions": {
// Includes only one of the fields `fetchCompressed`, `gzipOn`, `brotliCompression`
"fetchCompressed": {
"enabled": "boolean",
"value": "boolean"
},
"gzipOn": {
"enabled": "boolean",
"value": "boolean"
},
"brotliCompression": {
"enabled": "boolean",
"value": [
"string"
]
}
// end of the list of possible fields
},
"redirectOptions": {
// Includes only one of the fields `redirectHttpToHttps`, `redirectHttpsToHttp`
"redirectHttpToHttps": {
"enabled": "boolean",
"value": "boolean"
},
"redirectHttpsToHttp": {
"enabled": "boolean",
"value": "boolean"
}
// end of the list of possible fields
},
"hostOptions": {
// Includes only one of the fields `host`, `forwardHostHeader`
"host": {
"enabled": "boolean",
"value": "string"
},
"forwardHostHeader": {
"enabled": "boolean",
"value": "boolean"
}
// end of the list of possible fields
},
"staticHeaders": {
"enabled": "boolean",
"value": "string"
},
"cors": {
"enabled": "boolean",
"value": [
"string"
]
},
"stale": {
"enabled": "boolean",
"value": [
"string"
]
},
"allowedHttpMethods": {
"enabled": "boolean",
"value": [
"string"
]
},
"proxyCacheMethodsSet": {
"enabled": "boolean",
"value": "boolean"
},
"disableProxyForceRanges": {
"enabled": "boolean",
"value": "boolean"
},
"staticRequestHeaders": {
"enabled": "boolean",
"value": "string"
},
"customServerName": {
"enabled": "boolean",
"value": "string"
},
"ignoreCookie": {
"enabled": "boolean",
"value": "boolean"
},
"rewrite": {
"enabled": "boolean",
"body": "string",
"flag": "string"
},
"secureKey": {
"enabled": "boolean",
"key": "string",
"type": "string"
},
"ipAddressAcl": {
"enabled": "boolean",
"policyType": "string",
"exceptedValues": [
"string"
]
}
},
"secondaryHostnames": [
"string"
],
"originGroupId": "string",
"originGroupName": "string",
"originProtocol": "string",
"sslCertificate": {
"type": "string",
"status": "string",
"data": {
// Includes only one of the fields `cm`
"cm": {
"id": "string"
}
// end of the list of possible fields
}
},
"labels": "string"
}
// end of the list of possible fields
}
An Operation resource. For more information, see Operation.
Field |
Description |
id |
string ID of the operation. |
description |
string Description of the operation. 0-256 characters long. |
createdAt |
string (date-time) Creation timestamp. String in RFC3339 To work with values in this field, use the APIs described in the |
createdBy |
string ID of the user or service account who initiated the operation. |
modifiedAt |
string (date-time) The time when the Operation resource was last modified. String in RFC3339 To work with values in this field, use the APIs described in the |
done |
boolean If the value is |
metadata |
Service-specific metadata associated with the operation. |
error |
The error result of the operation in case of failure or cancellation. Includes only one of the fields The operation result. |
response |
The normal response of the operation in case of success. Includes only one of the fields The operation result. |
CreateResourceMetadata
Field |
Description |
resourceId |
string Required field. ID of created resource. |
Status
The error result of the operation in case of failure or cancellation.
Field |
Description |
code |
integer (int32) Error code. An enum value of google.rpc.Code |
message |
string An error message. |
details[] |
object A list of messages that carry the error details. |
Resource
A CDN resource - representation of providers resource.
Field |
Description |
id |
string ID of the resource. |
folderId |
string Folder id. |
cname |
string CDN endpoint CNAME, must be unique among resources. |
createdAt |
string (date-time) Creation timestamp. String in RFC3339 To work with values in this field, use the APIs described in the |
updatedAt |
string (date-time) Update timestamp. String in RFC3339 To work with values in this field, use the APIs described in the |
active |
boolean Flag to create Resource either in active or disabled state. |
options |
Resource settings and options to tune CDN edge behavior. |
secondaryHostnames[] |
string List of secondary hostname strings. |
originGroupId |
string (int64) ID of the origin group. |
originGroupName |
string Name of the origin group. |
originProtocol |
enum (OriginProtocol) Specify the protocol schema to be used in communication with origin.
|
sslCertificate |
SSL certificate options. |
labels |
string Labels of the resource. |
ResourceOptions
A major set of various resource options.
Field |
Description |
disableCache |
Set up a cache status. |
edgeCacheSettings |
Set up EdgeCacheSettings. |
browserCacheSettings |
Using Int64Option. Set up a cache period for the end-users browser. |
cacheHttpHeaders |
List HTTP headers that must be included in responses to clients. |
queryParamsOptions |
Set up QueryParamsOptions. |
slice |
Files larger than 10 MB will be requested and cached in parts (no larger than 10 MB each part). It reduces time to first byte. The origin must support HTTP Range requests. By default the option is disabled. |
compressionOptions |
Set up compression variant. |
redirectOptions |
Set up redirects. |
hostOptions |
Set up host parameters. |
staticHeaders |
Set up static headers that CDN servers send in responses to clients. |
cors |
Parameter that lets browsers get access to selected resources from a domain |
stale |
List of errors which instruct CDN servers to serve stale content to clients. Possible values: |
allowedHttpMethods |
HTTP methods for your CDN content. By default the following methods |
proxyCacheMethodsSet |
Allows caching for GET, HEAD and POST requests. |
disableProxyForceRanges |
Disabling proxy force ranges. |
staticRequestHeaders |
Set up custom headers that CDN servers send in requests to origins. |
customServerName |
Wildcard additional CNAME. |
ignoreCookie |
Using BoolOption for ignoring cookie. |
rewrite |
Changing or redirecting query paths. |
secureKey |
Secure token to protect contect and limit access by IP addresses and time limits. |
ipAddressAcl |
Manage the state of the IP access policy option. |
BoolOption
Set up bool values.
Field |
Description |
enabled |
boolean True - the option is enabled and its |
value |
boolean Value of the option. |
EdgeCacheSettings
A set of the edge cache parameters.
Field |
Description |
enabled |
boolean True - the option is enabled and its |
value |
Value of the option. Includes only one of the fields |
defaultValue |
string (int64) Content will be cached according to origin cache settings. Includes only one of the fields |
CachingTimes
A set of the caching response time parameters.
Field |
Description |
simpleValue |
string (int64) Caching time for a response with codes 200, 206, 301, 302. |
customValues |
string (int64) Caching time for a response with specific codes. These settings have a higher priority than the value field. |
Int64Option
A set of the numeric parameters.
Field |
Description |
enabled |
boolean True - the option is enabled and its |
value |
string (int64) Value of the option. |
StringsListOption
A set of the string list parameters.
Field |
Description |
enabled |
boolean True - the option is enabled and its |
value[] |
string Value of the option. |
QueryParamsOptions
A set of the query parameters.
Field |
Description |
ignoreQueryString |
Using BoolOption. Selected by default. Files with different query parameters are cached as objects with the same key regardless of the parameter value. Includes only one of the fields |
queryParamsWhitelist |
Ignore All Except. Includes only one of the fields |
queryParamsBlacklist |
Ignore only. Files with the specified query parameters are cached as objects with the same key, Includes only one of the fields |
CompressionOptions
A set of the compression variant parameters.
Field |
Description |
fetchCompressed |
The Fetch compressed option helps you to reduce Includes only one of the fields |
gzipOn |
Using BoolOption. GZip compression at CDN servers reduces file size by 70% and can be as high as 90%. Includes only one of the fields |
brotliCompression |
The option allows to compress content with brotli on the CDN's end. Compression is performed on the Origin Shielding. If a pre-cache server doesn't active for a resource, compression does not occur even if the option is enabled. Specify the content-type for each type of content you wish to have compressed. CDN servers will request only uncompressed content from the origin. Includes only one of the fields |
RedirectOptions
A set of the redirect parameters.
Field |
Description |
redirectHttpToHttps |
Using BoolOption. Set up a redirect from HTTPS to HTTP. Includes only one of the fields |
redirectHttpsToHttp |
Using BoolOption. Set up a redirect from HTTP to HTTPS. Includes only one of the fields |
HostOptions
A set of the host parameters.
Field |
Description |
host |
Custom value for the Host header. Your server must be able to process requests with the chosen header. Default value (if StringOption.enabled is Includes only one of the fields |
forwardHostHeader |
Using BoolOption. Choose the Forward Host header option if is important to send in the request to the Origin Includes only one of the fields |
StringOption
A set of the string parameters.
Field |
Description |
enabled |
boolean True - the option is enabled and its |
value |
string Value of the option. |
StringsMapOption
A set of the strings map parameters.
Field |
Description |
enabled |
boolean True - the option is enabled and its |
value |
string Value of the option. |
RewriteOption
An option for changing or redirecting query paths.
Field |
Description |
enabled |
boolean True - the option is enabled and its |
body |
string Pattern for rewrite. The value must have the following format: |
flag |
enum (RewriteFlag) Break flag is applied to the option by default.
|
SecureKeyOption
Field |
Description |
enabled |
boolean True - the option is enabled and its flag is applied to the resource. |
key |
string The key for the URL signing. |
type |
enum (SecureKeyURLType) The type of the URL signing. The URL could be available for all IP addresses or for the only one IP.
|
IPAddressACLOption
Field |
Description |
enabled |
boolean True - the option is enabled and its flag is applied to the resource. |
policyType |
enum (PolicyType) The policy type. One of allow or deny value.
|
exceptedValues[] |
string The list of IP addresses to be allowed or denied. |
SSLCertificate
A SSL certificate parameters.
Field |
Description |
type |
enum (SSLCertificateType) Type of the certificate.
|
status |
enum (SSLCertificateStatus) Active status.
|
data |
Certificate data. |
SSLCertificateData
A certificate data parameters.
Field |
Description |
cm |
Custom (add your SSL certificate by uploading the certificate Includes only one of the fields |
SSLCertificateCMData
A certificate data custom parameters.
Field |
Description |
id |
string ID of the custom certificate. |