In the Identity API v3, the id of the X-Auth-Token ( e.g. X-Subject-Token: 51aj73145b553he7bdfgb9fa8b53bede ) locates in the response header, not in the body part. To get the id of the X-Auth-Token with the cURL tool, please follow the example below:
curl -i -H "Content-Type: application/json" -d '{ "auth": {"identity": {"methods": ["password"], "password": {"user": {"name": "1011131", "domain": { "id": "default" }, "password": "KGrhJKFjmyqabBay" }}}}}' "https://auth.files.nl01.cloud.servers.com:5000/v3/auth/tokens" ; echo
Where:
name
is the first part is your Openstack Swift username ( e.g . “name”: “1011131” ) and the second part is your Openstack Swift tenant-name (e.g 1011131.1011131).
For the id of the domain
, you should explicitly typedefault
( e.g. “domain”: { “id”: “default” } ).
is the FTP password, which can be obtained through the Universal CDN Control Panel ( e.g. “password”: “KGrhJKFjmyqabBay” ).
password
The authorization URL for storage containers located in Europe:
https://auth.files.nl01.cloud.servers.com:5000/v3/auth/tokens
The authorization URL for storage containers located in North America:
https://auth.files.us01.cloud.servers.com:5000/v3/auth/tokens
Example:
$ curl -i -H "Content-Type: application/json" -d '{ "auth": {"identity": {"methods": ["password"], "password": {"user": {"name": "1011131", "domain": { "id": "default" }, "password": "KGrhJKFjmyqabBay" }}}}}' "https://auth.files.nl01.cloud.servers.com:5000/v3/auth/tokens" ; echo
HTTP/1.1 201 Created
Date: Wed, 11 Aug 2021 06:16:23 GMT
Server: Apache/2.4.18 (Ubuntu)
X-Subject-Token: 51aj73145b553he7bdfgb9fa8b53bede
Vary: X-Auth-Token
X-Distribution: Ubuntu
x-openstack-request-id: req-a3ce4e45-4b46-4aef-8ae2-5c12bb221c6b
Content-Length: 1922
Content-Type: application/json
{"token": {"is_domain": false, "methods": ["password"], "roles": [{"id": "9fe2ff9ee4384b1894a90878d3e92bab", "name": "_member_"}, {"id": "36df16334ce54a0a80527b1df2db7974", "name": "SwiftOperator"}], "expires_at": "2021-08-12T06:16:23.000000Z", "project": {"domain": {"id": "default", "name": "Default"}, "id": "31c646340f83401ebc46e770e0cd449f", "name": "1011131"}, "catalog": [{"endpoints": [{"url": "https://storage.files.nl01.cloud.servers.com:8080/v1/SERVERSCOM_31c646340f83401ebc46e770e0cd449f", "interface": "public", "region": "ams-1", "region_id": "ams-1", "id": "0414c0c1ce44403fbc476f70afe92d90"}, {"url": "https://storage.files.nl01.cloud.servers.com:8080/v1", "interface": "admin", "region": "ams-1", "region_id": "ams-1", "id": "18654ed293e54241a2400a4bb0e5baa4"}, {"url": "https://storage.files.nl01.cloud.servers.com:8080/v1/SERVERSCOM_31c646340f83401ebc46e770e0cd449f", "interface": "internal", "region": "ams-1", "region_id": "ams-1", "id": "350380b43a974e5f851cb078cc99c8ee"}], "type": "object-store", "id": "d3d7d4a01f62488ca7fbbb725bb125a2", "name": "swift"}, {"endpoints": [{"url": "https://auth.files.nl01.cloud.servers.com:5000/", "interface": "public", "region": "ams-1", "region_id": "ams-1", "id": "2c352870a2cc4c6b9319236915698014"}, {"url": "http://keystone.p.swift-ams-1.mgm.servers.com:5001/", "interface": "internal", "region": "ams-1", "region_id": "ams-1", "id": "93cf6481f4974f11a07d7321ec3cdd9c"}, {"url": "http://keystone.p.swift-ams-1.mgm.servers.com:35357/", "interface": "admin", "region": "ams-1", "region_id": "ams-1", "id": "e65c7bf7fcf4493da425deb56b1f1710"}], "type": "identity", "id": "a6eaea6661834e50bba6b31b375b2d29", "name": "keystone"}], "user": {"password_expires_at": null, "domain": {"id": "default", "name": "Default"}, "id": "8e5a4feec6864bf1b8b88ff2dcebf828", "name": "1011131"}, "audit_ids": ["R1H6KaCIQVG5tFejqNBBCg"], "issued_at": "2021-08-11T06:16:23.000000Z"}}
Our Cloud Storage is OpenStack Object Storage (swift) type. To make, for example, a post request to upload a file to your storage container, please use the “catalog” URL (swift endpoint) from the body of the output above:
"https://storage.files.nl01.cloud.servers.com:8080/v1/SERVERSCOM_31c646340f83401ebc46e770e0cd449f"
Example:
curl -i -X PUT -T /path_to_your_file -H "X-Auth-Token: 51aj73145b553he7bdfgb9fa8b53bede" "https://storage.files.nl01.cloud.servers.com:8080/v1/SERVERSCOM_31c646340f83401ebc46e770e0cd449f/your_storage_name/your_file_name"
Where:
“X-Auth-Token is the value of the X-Subject-Token from the header (X-Subject-Token: 51aj73145b553he7bdfgb9fa8b53bede)
https://storage.files.nl01.cloud.servers.com:8080/v1/SERVERSCOM_ is the catalog URL from the body.
For storage containers located in North America, the catalog URL will start as follows:
https://storage.files.us01.cloud.servers.com:8080/v1/SERVERSCOM_
Upload with Python-Swiftclient
Upload Large Files with Python-Swiftclient