Upload Through OpenStack Swift API

You can manage your CDN Storage container through Swift API. You can list all containers in your account, list all the objects in a container, upload, download, and delete resources. 


First, you need to obtain the “StorageURL” and the “Auth Token” for your account by using the following command: 

swift stat --verbose --os-username YOUR_USERNAME --os-tenant-name YOUR_TENANT --os-password YOUR_PASSWORD --os-auth-url 

Example: 

swift stat --verbose --os-username 1011131 --os-tenant-name 1011131 --os-password AHzfgGAkNGCoCpeW --os-auth-url https://auth.files.us01.cloud.servers.com:5000/v2.0/

Example output:

StorageURL: https://storage.files.us01.cloud.servers.com:8080/v1/SERVERSCOM_50d9a8b35b5a4bb4a80957fb52ab363c
Auth Token: 691632df959349298de14769e01aee99
Account: SERVERSCOM_50d9a8b35b5a4bb4a80957fb52ab363c
Containers: 1
Objects: 1
Bytes: 17839845
Containers in policy “policy-0”: 1
Objects in policy “policy-0”: 1
Bytes in policy “policy-0”: 17839845
Meta Temp-Url-Key: TinNbwQgxILBodufCWdMoueqYWPVtXvL
X-Account-Project-Domain-Id: _unknown
X-Timestamp: 1572600177.96722
X-Trans-Id: tx792146c4b79f4fecab69b-005fdaa01c
Content-Type: text/plain; charset=utf-8
Accept-Ranges: bytes


The token is valid for 24 hours from generation time.

For information about installing and using the python-swiftclient tool please click here!


Where

--os-username

Is the first part is your Openstack Swift username (–os-username) and the second part is your Openstack Swift tenant-name (–os-tenant-name) (e.g 1011131.1011131). 

Due to the requirements of the Object Storage service (swift) architecture, your FTP username contains two authentication parts separated by dot (.) character. 

In the provided example the Openstack Swift username (–os-username) is 1011131


--os-tenant-name

Is the second part of your FTP username is (–os-tenant-name). 

In the provided example the Openstack Swift tenant-name (–os-tenant-name) is 1011131


--os-password 

Is the FTP password, which can be obtained through the Universal CDN Control Panel. 


--os-auth-url 

Is the Swift authorization URL. 

Below are the authorization URLs that should be used: 

https://auth.files.nl01.cloud.servers.com:5000/v2.0/ – to connect to your Europe container. 

https://auth.files.us01.cloud.servers.com:5000/v2.0/ – to connect to your North American container.


Managing Universal CDN Storage with OpenStack Swift API using cURL. 


It is a well known command-line tool for transferring data to and from a server. Please review the following examples of some of the allowed operations that can be done with the OpenStack Swift API using cURL:


List all containers in an account:

$ curl -X GET -H 'X-Auth-Token: 691632df959349298de14769e01aee99' https://storage.files.us01.cloud.servers.com:8080/v1/SERVERSCOM_31c646340f83401ebc46e770e0cd669f/


List all the objects in a container:  

$ curl -X GET -H 'X-Auth-Token: 691632df959349298de14769e01aee99' https://storage.files.us01.cloud.servers.com:8080/v1/SERVERSCOM_31c646340f83401ebc46e770e0cd669f/container_name


Upload an object:

curl -X PUT -H 'X-Auth-Token: 691632df959349298de14769e01aee99' https://storage.files.us01.cloud.servers.com:8080/v1/SERVERSCOM_31c646340f83401ebc46e770e0cd669f/container_name/ -T test_file.mp4


Download an object:

curl -X GET -H 'X-Auth-Token: 691632df959349298de14769e01aee99' https://storage.files.us01.cloud.servers.com:8080/v1/SERVERSCOM_31c646340f83401ebc46e770e0cd669f/container_name/test_file.mp4 --output test_file.mp4


Delete an object: 

curl -X DELETE -H 'X-Auth-Token: 691632df959349298de14769e01aee99' https://storage.files.us01.cloud.servers.com:8080/v1/SERVERSCOM_31c646340f83401ebc46e770e0cd669f/container_name/test_file.mp4


IMPORTANT! 
Please note that the storage containers must be created only from the Universal CDN Control Panel. Storage containers created not from the Control Panel will be rejected by the CDN system.



FTP Upload

Upload with Python-Swiftclient

Upload Large Files with Python-Swiftclient

Upload with Rclone