Skip to main content

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

ParameterTypeRequiredDescription
serviceIdIntegerMandatoryService ID.

Body Parameters

ParameterTypeRequiredDescription
originsArrayMandatoryList 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.
defaultHostHeaderStringMandatoryApplies 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.
alternateDomainNamesString[]OptionalArray of alternate domain names.
streamingBooleanOptionalTo indicate if need to combine multiple requests as one request to origin server. true: Enabled, false: Disabled. Default is false.
http2BooleanOptionaltrue: Enabled, false: Disabled. Default is true.
http3BooleanOptionaltrue: Enabled, false: Disabled. Default is false.
redirectHttpToHttpsBooleanOptionalWhether redirect all plain HTTP requests to HTTPS. true: Enabled, false: Disabled. Default is false.
tlsProfileStringOptionalEffective 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.
enabledBooleanOptionalTo indicate if service is enabled or disabled. true: Enabled, false: Disabled. Default is true.

Object: Origin

Property nameTypeRequiredDescription
originUrlStringMandatoryThe 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.
sniStringOptionalThe server name to send to the origin during SSL handshake.
headersObjectOptionalThe Origin Headers containing extra headers to send to the origin.
s3CredentialObjectOptionalConfigure the S3 credential. See S3Credential for details.

Object: S3 Credential

Property nameTypeRequiredDescription
accessKeyStringMandatoryConfigure the AWS access key ID to generate the signature to access S3.
accessSecretStringMandatoryConfigure the AWS access secret to generate the signature to access S3.
regionStringMandatoryConfigure the AWS region. Example: ap-southeast-1.
dropQueryStringBooleanOptionalDrop the query string from the origin generating the signature to it. Default is false.

Response

Response Body

Property nameTypeDescription
idIntegerService ID number.
domainNameStringDomain name.
originsArrayList 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.
defaultHostHeaderStringApplies 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.
alternateDomainNamesString[]Array of alternate domain names.
streamingBooleanTo indicate if need to combine multiple requests as one request to origin server. true: Enabled, false: Disabled. Default is false.
http2Booleantrue: Enabled, false: Disabled. Default is true.
http3Booleantrue: Enabled, false: Disabled. Default is false.
redirectHttpToHttpsBooleanWhether redirect all plain HTTP requests to HTTPS. true: Enabled, false: Disabled. Default is false.
tlsProfileStringEffective TLS delivery profile for HTTP protocol.

Status Codes, Error Codes and Error Messages

Status CodeError CodeError Message
400InvalidCustomer.IdEmptyCustomer id can not be empty.
400InvalidService.IdIncorrectService id is incorrect.
400InvalidService.EmptyService cannot be empty.
400InvalidService.OriginsEmptyOrigins cannot be empty.
400InvalidService.OriginEmptyOrigin cannot be empty.
400InvalidService.OriginUrlEmptyOrigin Url cannot be empty.
400InvalidService.S3CredentialAccessKeyEmptyAccessKey cannot be Empty.
400InvalidService.S3CredentialAccessSecretEmptyAccessSecret cannot be Empty.
400InvalidService.S3CredentialRegionEmptyRegion cannot be Empty.
400InvalidService.DefaultHostHeaderEmptyDefault Host Header cannot be empty.
400InvalidService.DefaultHostHeaderInCorrectDefault Host Header InCorrect.
400InvalidService.TLSProfileInCorrecttlsProfile InCorrect.
404InvalidService.NotFoundService can not be found.
409DomainName.ExistDomain 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"
}