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 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.
defaultHostHeaderStringMandatorySpecifies 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.
alternateDomainNamesArrayOptionalList of alternate domain names for the service.
streamingBooleanOptionalWhether to combine multiple client requests to a single request to the origin server. true: Enabled, false: Disabled. Default is false.
http2BooleanOptionalEnable HTTP/2 protocol. Default is true.
http3BooleanOptionalEnable HTTP/3 protocol. Default is false.
redirectHttpToHttpsBooleanOptionalWhether to redirect all HTTP requests to HTTPS. Default is false.
tlsProfileStringOptionalTLS 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.
enabledBooleanOptionalWhether the service is enabled. Default is true.

Object: Origin

Property nameTypeRequiredDescription
originUrlStringMandatoryOrigin service 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.
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 (e.g., ap-southeast-1).
dropQueryStringBooleanOptionalDrop the query string from the origin generating the signature to it. Default is false.

Response

Response Body

Property nameTypeDescription
idIntegerUnique service identifier.
domainNameStringPrimary domain name for acceleration.
originsArrayList 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.
defaultHostHeaderStringSpecifies 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.
alternateDomainNamesArrayList of alternate domain names for the service.
streamingBooleanWhether to combine multiple client requests into a single request to the origin server. true: Enabled, false: Disabled. Default is false.
http2BooleanEnable HTTP/2 protocol. Default is true.
http3BooleanEnable HTTP/3 protocol. Default is false.
redirectHttpToHttpsBooleanWhether to redirect all HTTP requests to HTTPS. Default is false.
tlsProfileStringTLS 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.
enabledBooleanWhether the service is enabled. Default is true.

Status Codes, Error Codes and Error Messages

Status CodeError CodeError Message
400InvalidCustomer.IdEmptyCustomer ID cannot be empty.
400InvalidService.IdIncorrectService ID is invalid.
400InvalidService.EmptyService cannot be empty.
400InvalidService.OriginsEmptyOrigins cannot be empty.
400InvalidService.OriginEmptyOrigin cannot be empty.
400InvalidService.OriginUrlEmptyOrigin URL cannot be empty.
400InvalidService.S3CredentialAccessKeyEmptyS3 access key cannot be empty.
400InvalidService.S3CredentialAccessSecretEmptyS3 access secret cannot be empty.
400InvalidService.S3CredentialRegionEmptyS3 region cannot be empty.
400InvalidService.DefaultHostHeaderEmptyDefault host header cannot be empty.
400InvalidService.DefaultHostHeaderInCorrectDefault host header value is invalid.
400InvalidService.TLSProfileInCorrectTLS profile value is invalid.
404InvalidService.NotFoundService cannot be found.
409InvalidService.DomainNameDomain 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": [
"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"
],
"cName": "edge2x.testing.veloceed.com"
}