Create Service
This API is used to create a website acceleration service.
Request
Request-Line
POST /cdn/v1.0/service HTTP/1.1
Request Parameters
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| domainName | String | Mandatory | Primary domain name for acceleration. |
| origins | Array | Mandatory | List of origin servers. At least one origin is required. For multiple origins, the order determines the priority (the first one is primary, subsequent ones are fallbacks). See Origin for details. |
| defaultHostHeader | String | Mandatory | Specifies the default host header and SNI when no explicit host header or SNI is configured. preserve: Maintains the host header and SNI from the original request. originHost: Uses the host from the origin URL. |
| alternateDomainNames | Array | Optional | List of alternate domain names for the service. |
| streaming | Boolean | Optional | Whether to combine multiple client requests into a single request to the origin server. true: Enabled, false: Disabled. Default is false. |
| http2 | Boolean | Optional | Enable HTTP/2 protocol. Default is true. |
| http3 | Boolean | Optional | Enable HTTP/3 protocol. Default is false. |
| redirectHttpToHttps | Boolean | Optional | Whether to redirect all HTTP requests to HTTPS. Default is false. |
| tlsProfile | String | Optional | TLS security profile. modern: TLS 1.3 only, highest security, no backward compatibility. intermediate: Recommended for most services, compatible with modern clients. old: Maximum compatibility, use only for legacy client support. |
| enabled | Boolean | Optional | Whether the service is enabled. Default is true. |
Object: Origin
| Property name | Type | Required | Description |
|---|---|---|---|
| originUrl | String | Mandatory | Origin server address. Format: [http[s]://]hostname[:port][/path/prefix]. If scheme is specified, it is forced for all origin requests. If omitted, the client's protocol is used. |
| sni | String | Optional | Server Name Indication (SNI) value to send during TLS handshake with the origin. |
| headers | Object | Optional | Custom headers to include when requesting from the origin. |
| s3Credential | Object | Optional | S3-compatible storage credentials. See S3Credential for details. |
Object: S3Credential
| Property name | Type | Required | Description |
|---|---|---|---|
| accessKey | String | Mandatory | AWS access key ID for generating S3 signature. |
| accessSecret | String | Mandatory | AWS access secret for generating S3 signature. |
| region | String | Mandatory | AWS region, e.g., ap-southeast-1. |
| dropQueryString | Boolean | Optional | Whether to drop query strings before generating the S3 signature. Default is false. |
Response
Response Body
| Property name | Type | Description |
|---|---|---|
| id | Integer | Service ID number. |
| domainName | String | Primary domain name for acceleration. |
| origins | Array | List of origin servers. At least one origin is required. For multiple origins, the order determines the priority (the first one is primary, subsequent ones are fallbacks). See Origin for details. |
| defaultHostHeader | String | Specifies the default host header and SNI when no explicit host header or SNI is configured. preserve: Maintains the host header and SNI from the original request. originHost: Uses the host from the origin URL. |
| alternateDomainNames | Array | List of alternate domain names for the service. |
| streaming | Boolean | Whether to combine multiple client requests into a single request to the origin server. true: Enabled, false: Disabled. Default is false. |
| http2 | Boolean | Enable HTTP/2 protocol. Default is true. |
| http3 | Boolean | Enable HTTP/3 protocol. Default is false. |
| redirectHttpToHttps | Boolean | Whether to redirect all HTTP requests to HTTPS. Default is false. |
| tlsProfile | String | TLS security profile. modern: TLS 1.3 only, highest security, no backward compatibility. intermediate: Recommended for most services, compatible with modern clients. old: Maximum compatibility, use only for legacy client support. |
| enabled | Boolean | Whether the service is enabled. Default is true. |
Status Codes, Error Codes and Error Messages
| Status Code | Error Code | Error Message |
|---|---|---|
| 400 | InvalidCustomer.IdEmpty | Customer ID cannot be empty. |
| 400 | InvalidService.Empty | Service cannot be empty. |
| 400 | InvalidService.DomainNameEmpty | Domain name cannot be empty. |
| 400 | InvalidService.OriginsEmpty | Origins cannot be empty. |
| 400 | InvalidService.OriginEmpty | Origin cannot be empty. |
| 400 | InvalidService.OriginUrlEmpty | Origin URL cannot be empty. |
| 400 | InvalidService.S3CredentialAccessKeyEmpty | S3 access key cannot be empty. |
| 400 | InvalidService.S3CredentialAccessSecretEmpty | S3 access secret cannot be empty. |
| 400 | InvalidService.S3CredentialRegionEmpty | S3 region cannot be empty. |
| 400 | InvalidService.DefaultHostHeaderEmpty | Default host header cannot be empty. |
| 400 | InvalidService.DefaultHostHeaderInCorrect | Default host header value is invalid. |
| 400 | InvalidService.TLSProfileInCorrect | TLS profile value is invalid. |
| 409 | InvalidService.DomainName | Domain name already exists. |
| 500 | InvalidCustomer.ProvisionNotFound | Customer provision record not found. Please contact support. |
Examples
Create Service
Request
POST /cdn/v1.0/service HTTP/1.1
{
"domainName": "test.example.com",
"origins": [
{
"originUrl": "https://origin1.example.com",
"sni": "origin-sni.example.com",
"headers": {
"X-Forwarded-For": "client-ip",
"X-Custom-Header": "test-value",
"Host": "origin-host.example.com"
},
"s3Credential": {
"accessKey": "AKIAEXAMPLE123456",
"accessSecret": "secret1234567890abcdefghijklmnopqrstuvwxyz",
"region": "us-east-1",
"dropQueryString": false
}
}
],
"defaultHostHeader": "originHost",
"alternateDomainNames": [
"cdn.example.com",
"www.test.example.com"
],
"streaming": true,
"http2": true,
"http3": false,
"redirectHttpToHttps": true,
"tlsProfile": "modern",
"enabled": true
}
Successful Response Body
{
"id": 228622,
"domainName": "test.example.com",
"streaming": true,
"http2": true,
"http3": false,
"redirectHttpToHttps": true,
"enabled": true,
"tlsProfile": "modern",
"origins": [
{
"originUrl": "https://origin1.example.com",
"sni": "origin-sni.example.com",
"headers": {
"X-Custom-Header": "test-value",
"X-Forwarded-For": "client-ip",
"Host": "origin-host.example.com"
},
"s3Credential": {
"accessKey": "AKIAEXAMPLE123456",
"accessSecret": "secret1234567890abcdefghijklmnopqrstuvwxyz",
"region": "us-east-1",
"dropQueryString": false
}
}
],
"defaultHostHeader": "originHost",
"alternateDomainNames": [
"cdn.example.com",
"www.test.example.com"
],
"cName": "edge2x.testing.veloceed.com"
}