Edit Service
This API is used to edit website acceleration service.
Request
Request-Line
PUT /cdn/v1.0/service/{serviceId} HTTP/1.1
Request Parameters
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| serviceId | Integer | Mandatory | Service ID. |
Body Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| origins | Array | Mandatory | List of Origin, need at least one Origin. and for multi Origin, the priority as the List sequence, there will be fallback is the front origin is fail. See Origin for details. |
| defaultHostHeader | String | Mandatory | Applies when no host header or SNI is configured. Both host header and SNI can be configured in the origin control. preserve:Maintains the host header and SNI from the original request. originHost:Maintains the host header and SNI from the host in the origin URL. |
| alternateDomainNames | String[] | Optional | Array of alternate domain names. |
| streaming | Boolean | Optional | To indicate if need to combine multiple requests as one request to origin server. true: Enabled, false: Disabled. Default is false. |
| http2 | Boolean | Optional | true: Enabled, false: Disabled. Default is true. |
| http3 | Boolean | Optional | true: Enabled, false: Disabled. Default is false. |
| redirectHttpToHttps | Boolean | Optional | Whether redirect all plain HTTP requests to HTTPS. true: Enabled, false: Disabled. Default is false. |
| tlsProfile | String | Optional | Effective TLS delivery profile for HTTP protocol. modern:For services with clients that support TLS 1.3 and backward compatibility is not required. Provides the highest security level. intermediate:For modern clients, not compatible with legacy systems (e.g., Windows XP, legacy OpenSSL). Recommended for most services. old:For maintaining compatibility with very old clients. Use only if legacy support is strictly required. |
| enabled | Boolean | Optional | To indicate if service is enabled or disabled. true: Enabled, false: Disabled. Default is true. |
Object: Origin
| Property name | Type | Required | Description |
|---|---|---|---|
| originUrl | String | Mandatory | The origin address. Has the following format: [http[s]://]hostname[:port][/path/prefix]. The bits in [] are optional. If the scheme (http/https) is explicitly specified then it is forced for all origin requests, otherwise (scheme is omitted) the protocol used by client is used to contact the origin. |
| sni | String | Optional | The server name to send to the origin during SSL handshake. |
| headers | Object | Optional | The Origin Headers containing extra headers to send to the origin. |
| s3Credential | Object | Optional | Configure the S3 credential. See S3Credential for details. |
Object: S3 Credential
| Property name | Type | Required | Description |
|---|---|---|---|
| accessKey | String | Mandatory | Configure the AWS access key ID to generate the signature to access S3. |
| accessSecret | String | Mandatory | Configure the AWS access secret to generate the signature to access S3. |
| region | String | Mandatory | Configure the AWS region. Example: ap-southeast-1. |
| dropQueryString | Boolean | Optional | Drop the query string from the origin generating the signature to it. Default is false. |
Response
Response Body
| Property name | Type | Description |
|---|---|---|
| id | Integer | Service ID number. |
| domainName | String | Domain name. |
| origins | Array | List of Origin, need at least one Origin. and for multi Origin, the priority as the List sequence, there will be fallback is the front origin is fail. See Origin for details. |
| defaultHostHeader | String | Applies when no host header or SNI is configured. Both host header and SNI can be configured in the origin control. preserve:Maintains the host header and SNI from the original request. originHost:Maintains the host header and SNI from the host in the origin URL. |
| alternateDomainNames | String[] | Array of alternate domain names. |
| streaming | Boolean | To indicate if need to combine multiple requests as one request to origin server. true: Enabled, false: Disabled. Default is false. |
| http2 | Boolean | true: Enabled, false: Disabled. Default is true. |
| http3 | Boolean | true: Enabled, false: Disabled. Default is false. |
| redirectHttpToHttps | Boolean | Whether redirect all plain HTTP requests to HTTPS. true: Enabled, false: Disabled. Default is false. |
| tlsProfile | String | Effective TLS delivery profile for HTTP protocol. |
Status Codes, Error Codes and Error Messages
| Status Code | Error Code | Error Message |
|---|---|---|
| 400 | InvalidCustomer.IdEmpty | Customer id can not be empty. |
| 400 | InvalidService.IdIncorrect | Service id is incorrect. |
| 400 | InvalidService.Empty | Service 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 | AccessKey cannot be Empty. |
| 400 | InvalidService.S3CredentialAccessSecretEmpty | AccessSecret cannot be Empty. |
| 400 | InvalidService.S3CredentialRegionEmpty | Region cannot be Empty. |
| 400 | InvalidService.DefaultHostHeaderEmpty | Default Host Header cannot be empty. |
| 400 | InvalidService.DefaultHostHeaderInCorrect | Default Host Header InCorrect. |
| 400 | InvalidService.TLSProfileInCorrect | tlsProfile InCorrect. |
| 404 | InvalidService.NotFound | Service can not be found. |
| 409 | DomainName.Exist | Domain name already exists. |
Examples
Edit Service
Request
PUT /cdn/v1.0/services/228622 HTTP/1.1
{
"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"
},
"s3Credential": {
"accessKey": "AKIAEXAMPLE123456",
"accessSecret": "secret1234567890abcdefghijklmnopqrstuvwxyz",
"region": "us-east-1",
"dropQueryString": false
}
}
],
"defaultHostHeader": "originHost",
"alternateDomainNames": [
"oss.example.com",
"waf.test.example.com"
]
}
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"
},
"s3Credential": {
"accessKey": "AKIAEXAMPLE123456",
"accessSecret": "secret1234567890abcdefghijklmnopqrstuvwxyz",
"region": "us-east-1",
"dropQueryString": false
}
}
],
"defaultHostHeader": "originHost",
"alternateDomainNames": [
"waf.test.example.com",
"oss.example.com"
],
"cName": "edge2x.testing.swiftserve.com"
}