Create Domain

This API is used to create website acceleration domain.

1. Request Definition

  • API URL
https://cdn-api.swiftfederation.com/v2.0/domains
  • Request Method
POST
  • Request Header

Refer to HTTP Request Headers

  • Request Body

Request Body Data Format: JSON

Field Required Type Description
name Mandatory string Domain name.
customerId Mandatory int Customer ID of this domain.
origins Mandatory Origin[] 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.
streamingService Optional boolean To indicate if need to combine multiple requests as one request to origin server. true: Enabled, false: Disabled. Default is false.
http2 Optional boolean Enable HTTP/2 will allow client connect CDN by HTTP/2. Note: Please configure SSL certificate before you use HTTP/2. true: Enabled, false: Disabled. Default is false.
redirectHttpToHttps Optional boolean Whether redirect all plain http requests to https. true: Enabled, false: Disabled. Default is false.
active Optional boolean To indicate if service is enabled or disabled. true: Enabled, false: Disabled. Default is true.
Origin Definition
urlPrefix Mandatory string 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 Optional string The server name to send to the origin during SSL handshake, when missing the host name used in Origin URL is used.
headers Optional Map The Origin Headers containing extra headers to send to the origin. format: Dictionary {"HeaderName": "HeaderValue", ...}. E.g: {"Host": "origin.domain.com"}
  • Request Body Example
{
    "name": "cdn.website2.com",
    "customerId": 11,
    "origins":[
        {
            "urlPrefix":"https://origin.domain.com:8888/foo/bar",
            "sni":"origin-a.domain.com",
            "headers":{"Host":"origin-b.domain.com","X-Foo":"bar"}
        }
    ],
    "redirectHttpToHttps": true,
    "streamingService": true,
    "http2":true,
    "redirectHttpToHttps":true,
    "active": true
}


2. Response Definition

  • Response Header

Refer to HTTP Response Headers

  • Response Body
Field Type Description
id int Service ID number.
name string Domain name.
customerId int Customer ID of this domain.
origins Origin[] List of Origin.
deliveryDomain string Delivery domain which will be CName to.
streamingService boolean true: Enabled, false: Disabled.
http2 boolean true: Enabled, false: Disabled. If the value is not set, the default value will be used.
redirectHttpToHttps boolean Whether redirect all plain http requests to https. true: Enabled, false: Disabled. Default is false. If the value is not set, the default value will be used.
active boolean true: Enabled, false: Disabled.
  • Response Body Example
{
    "id": 101,
    "name": "www.website1.com",
    "customerId": 11,
    "origins":[
        {
            "urlPrefix":"https://origin.domain.com:8888/foo/bar",
            "sni":"origin-a.domain.com",
            "headers":{"Host":"origin-b.domain.com","X-Foo":"bar"}
        }
    ],
    "redirectHttpToHttps": true,
    "deliveryDomain": "edge.swiftserve.com",
    "streamingService": true,
    "http2":true,
    "active": true
}
           Updated 2021-11-04 03:03:08

results matching ""

    No results matching ""