We accelerate websites

15 days free trial Sign up

Media Acceleration Stream to the world

15 days free trial Sign up

Extensive Network Excellent world coverage

Storage API documentation

Introduction

The API enables integration with third party applications.

  • The API is REST
  • The API accepts only HTTPS requests
  • All function calls need authorization and authentication (Basic HTTP)

To authenticate using HTTP Basic use your CDN Storage username and password combination. Curl example:

curl --user username:password

Please note that the storage server SSL certificate used for HTTPS API connections (and for FTPS) is self-signed and thus you need to allow "insecure" SSL connections". Curl example:

curl --insecure

HTTP methods

The API uses the following HTTP methods:

GETUsed for retrieving information, e.g., list a directory
POSTUsed for creating new objects, e.g., create a directory
PUTUsed for altering object properties and uploading files
DELETEUsed for object deletion, e.g., delete a directory

Curl example

curl --insecure --user username:password --include --request POST --header 'Accept: application/json' --header 'Content-type: application/json' --url https://push-XX.cdnsun.com/content --data '{"content":{"path":"/images"}}'

HTTP response codes

The API returns appropriate HTTP status code for every request.

HTTP response bodies

The API returns appropriate HTTP response body for every request:

SuccessError
{
    "status": "success",
    "response_code": 200,
    "resource": "content",
    "action": "post",
    "message": "success",
    "data": {
        "path": "/images
    }
}
{
    "status": "error",
    "response_code": 401,
    "resource": "index",
    "action": "index",
    "message": "you are not authorized",
    "data": null
}

Documentation

  • Upload a file
    • URL: /content
    • Method: PUT
    • Params sources: GET, RAW REQUEST BODY
    • Request HTTP headers: Accept: application/json
    • Params:
      • path
        • Name: path
        • Data type: string
        • Example: /dir
        • Note: Allowed characters are a-z, A-Z, 0-9, -, _, . and /. Must not end with a slash / (must represent a file name not a directory name).
    • Mandatory: path
    • Curl example: curl --insecure --user username:password --include --request PUT --header 'Accept: application/json' --url https://push-XX.cdnsun.com/content?path=/dir/file --upload-file /path/to/your/local/file
    • Note: The entire PUT body will be treated as the file.
  • List a directory
    • URL: /content
    • Method: GET
    • Params sources: GET
    • Request HTTP headers: Accept: application/json
    • Params:
      • path
        • Name: path
        • Data type: string
        • Example: /dir
        • Note: Allowed characters are a-z, A-Z, 0-9, -, _, . and /.
    • Mandatory: path
    • Curl example: curl --insecure --user username:password --include --request GET --header 'Accept: application/json' --url https://push-XX.cdnsun.com/content?path=/
  • Create a directory
    • URL: /content
    • Method: POST
    • Params sources: POST (JSON)
    • Request HTTP headers: Content-type: application/json, Accept: application/json
    • Params:
      • path
        • Name: path
        • Data type: string
        • Example: /dir
        • Note: Allowed characters are a-z, A-Z, 0-9, -, _, . and /.
    • Mandatory: path
    • Curl example: curl --insecure --user username:password --include --request POST --header 'Content-type: application/json' --header 'Accept: application/json' --url https://push-XX.cdnsun.com/content --data '{"content":{"path":"\/dir"}}'
  • Remove a file or directory
    • URL: /content
    • Method: DELETE
    • Params sources: POST (JSON)
    • Request HTTP headers: Accept: application/json
    • Params:
      • path
        • Name: path
        • Data type: string
        • Example: /dir
        • Note: Allowed characters are a-z, A-Z, 0-9, -, _, . and /.
    • Mandatory: path
    • Curl example: curl --insecure --user username:password --include --request DELETE --header 'Accept: application/json' --url https://push-XX.cdnsun.com/content --data '{"content":{"path":"\/dir\/file"}}'

Please replace push-XX.cdnsun.com with the hostname of your storage, e.g., push-11.cdnsun.com.

What next?

Create a CDN Static Push or a CDN Video Push service.

 
           __   __             _    _   
    ___    \ \\/ //   ____    | || | || 
   /   ||   \ ` //   |    \\  | || | || 
  | [] ||    | ||    | [] ||  | \\_/ || 
   \__ ||    |_||    |  __//   \____//  
    -|_||    `-`'    |_|`-`     `---`   
     `-`             `-`                
Europe
  • Athens
  • Baku
  • Budapest
  • Chelyabinsk
  • Copenhagen
  • Dublin
  • Frankfurt
  • Helsingborg
  • Karlskrona
  • Khabarovsk
  • Kharkov
  • Kiev
  • Kungalv
  • Lisbon
  • London
  • Lvov
  • Madrid
  • Milan
  • Moscow
  • Odessa
  • Oslo
  • Paris
  • Polevskoy
  • Saint Petersburg
  • Stockholm
  • Tel Aviv-Yafo
  • Trondheim
  • Zagreb
America
  • Arlington
  • Atlanta
  • Chicago
  • Dallas
  • Denver
  • Green Bay
  • Los Angeles
  • Miami
  • Montreal
  • New York
  • Phoenix
  • Portland
  • Provo
  • Queretaro
  • Reston
  • Sacramento
  • San Jose
  • Sao Paulo
  • Seattle
  • Toronto
  • Washington
Contact
  • e-mail: info@cdnsun.com
  • skype: cdnsun.com
  • phone: +1 844 300 9206
  • phone: +420 776 256 872
Blog Twitter LinkedIn Facebook CrunchBase Google+ / Google plus Foursquare Pinterest