Create a service (POST /v1/services)

Creates a service and starts content delivery.

Specify the parameters pre-FQDN, delivery protocol scheme, initial delivery status, container for storing access logs and object prefix, and in the request body specify (in JSON format) the caching behavior control rules. The minimum caching behavior control rule required to be specified is a match condition on the origin (for example, "url-wildcard":"/*"). For this sample code, refer to description of the contents delivery on the web site in "The use case of the Web system integration" in the "IaaS Features Handbook". In this case, specify any value (for example, "-") to the origin behavior digitalProperty of the caching behavior control rules. Refer to "Appendix A Caching Rules" for details on caching behavior control rules.

Upon successful completion, the Location response header will return service_id which identifies the content delivery setting. Details can then be retrieved by specifying service_id in the service retrieval API.

Refer to the X-Access-URL response header returned using the service retrieval API for the delivery FQDN temporarily assigned by Fujitsu to the customer when a service is created. The FQDN will be maintained until the service is deleted.

Refer to the X-Status response header returned using the service retrieval API for the propagation status of the service to Akamai CDN can be obtained using the X-Status response header obtained from the service retrieval API. When the status changes to "deployed", end-user access to the edge server is enabled (content delivery is enabled).

Syntax check for the caching behavior control rules specified in the request body is performed asynchronously. If the X-Status response header returned using the retrieval API is "failed", the description for the rules may contain errors, so refer to the X-Message and X-Error headers.

Even if the caching behavior control rules do not provide description for the origin behavior or restrict access to its FQDN, the rules are still valid, so ultimately access the edge server to check operations.

If the delivery status is set to "deactivate", only assignment is performed for domains while the propagation to Akamai CDN is stopped. If starting content delivery, change the delivery status to "activate" in the service update API.

If a valid value is specified in the "container" parameters, it starts storing access logs. A write test will be performed in the test object objectStorageEndpointOfEastJapanRegion+AUTH_{project_id}+"/"+container+"/"+object_prefix+"_start". If "object_prefix" is empty or not specified, it will be stored immediately under the container.

If "container" is empty or not specified, it does not start storing access logs.

When a valid public key object is specified for key_object, access logs are encrypted and then stored. For details on how to create public keys and decrypt encrypted access logs, refer to the "IaaS Features Handbook".

Refer to the X-Access-Log-Status, X-Access-Log-Container, X-Access-Log-Object-Prefix, X-Access-Log-Key-Container, X-Access-Log-Key-Object, and X-Access-Log-Detailed-Status response headers in the service retrieval API for storage status, errors, and setting values of access logs.

Refer to the "IaaS Features Handbook" for details on the CSV format that can be obtained using the access log feature.

The table below lists the main status codes and X-Message header values.

Status code X-Message header
202 Accepted: Request was received
200 No services to return: No services (empty list)
400 Invalid Json: Invalid JSON format
400 Invalid entry for pre_fqdn/protocol/status: Invalid value
400 Invalid entry for container/object_prefix: Invalid value
400 Invalid entry for key_container/key_object: Invalid value (when the corresponding public key is not stored there)
507 Quota exceeded: The maximum number that can be created is exceeded

Request Headers

Refer to "Common API request headers" for details.

Request parameters

pre_fqdn

FQDN for the service. Refer to the "IaaS Features Handbook" for details.
  • If using a your own domain name: Specify the FQDN

    The user needs to set CNAME for the DNS server.

  • If not using a your own domain name : Specify prefix (default: no prefix)
Data Type Cardinality
String 0..1

protocol

Delivery protocol scheme.
  • http: Use HTTP for delivery (default).
  • https: Use HTTPS for delivery. HTTP access to edge server will be redirected to HTTPS.
Data Type Cardinality
String 0..1

status

Initial status
  • activate: Enables content delivery (default)
  • deactivate: Disables content delivery
Data Type Cardinality
String 0..1

container

Container of object storage where the access logs are stored
  • If a value is specified: Sets the access log storage destination to the specified location
  • If no value is specified: Does not store access logs (default)
Data Type Cardinality
String 0..1

object_prefix

Prefix indicating access log object name. Pseudo path information can be included.

Example: "path/PRE01_", "PRE01_", etc.

Data Type Cardinality
String 0..1

key_container

The container for the object storage where the public key used for encrypting access logs is stored.
  • If the string indicating the container name is specified: Refers to the specified container
  • If no value is specified: Uses the value for container explained above (default)
Data Type Cardinality
String 0..1

key_object

Object name of the public key used for encrypting access logs. Pseudo path information can be included. The public key object must be stored beforehand.
  • If a string indicating an object name is specified: Encrypt access logs
  • If no value is specified: Does not encrypt access logs (default)

Example:"public_key"

Data Type Cardinality
String 0..1

Request Elements

rules

Caching behavior control rules. Refer to "Appendix A Caching Rules" for details.

Data Type Cardinality Parent Element Child Element(s)
String 1..1 None Refer to JSON schema for details on the rules.

Response Headers

Refer to "Common API response headers" for details.

Location

URL including service_id.

Data Type Cardinality
String 1..1

Response Elements

None.

Example of Response


       POST/v1/services?protocol=http&status=activate
       Content-type: application/json
       Content-Length: 375
       
       {
         "rules": [
           {
             "matches": [
               {
                 "name": "url-wildcard",
                 "value": "/*"
               }
             ],
             "behaviors": [
               {
                 "params":
                   {
                     "cacheKeyValue": "-",
                     "digitalProperty": "-",
                     "cacheKeyType": "origin",
                     "hostHeaderValue": "-",
                     "originDomain": "jp.fujitsu.com",
                     "hostHeaderType": "origin"
                   },
                 "name": "origin",
                 "value": "-"
               },
               {
                 "type": "fixed",
                 "name": "caching",
                 "value": "1d"
               }
             ]
           }
         ]
       }
       
       HTTP/1.1 202 Accepted
       Location: http://<Endpoint>/v1/services/2b7368fd-f243-496d-a1d5-16da2e5a3e0d
       X-Message: Accepted
       Content-Length: 0