If you need to store images, videos, documents or other files and objects, you should save your objects not to a data base or disk, but to an Object Storage.
Documentation:
https://www.ng.bluemix.net/docs/services/ObjectStorage/index.html
Steps:
1. Get Access Token and Public URL
2. Get Account details
3. Create Container
4. Create Object
Get Access Token and Public URL
curl -X POST -H "Content-Type: application/json" -d '{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"id": "<userId>",
"password": "<password>"
}
}
},
"scope": {
"project": {
"id": "<projectId>"
}
}
}
}' 'https://identity.open.softlayer.com/v3/auth/tokens'
This returns an ‘X-Subject-Token’ or the access token in the HTTP Header of the response, and configuration details with among other a catalog of endpoints for your object storage service.
"catalog": [
{
"endpoints": [
{
"region_id": "dallas",
"url": "https://dal.objectstorage.open.softlayer.com/v1/<account>",
"region": "dallas",
"interface": "public",
"id": "123"
}
]
}
]
You can use the public url in the region on your Object Storage service, to make the REST API calls to your object storage.
Get Account details
Request URI
GET {{objectstorage-public-url}}
Request HTTP Header
X-Auth-Token: <X-Subject-Token>
Response HTTP Header
X-Account-Bytes-Used → 0
X-Account-Container-Count → 1
X-Account-Object-Count → 1
Response Body
[
{
"count": 1,
"bytes": 0,
"name": "<containername>"
}
]
Create Container
Request URI
PUT {{objectstorage-public-url}}/<container-name>
Request HTTP Header
X-Auth-Token: <X-Subject-Token>
Create Object
Request URI
PUT {{objectstorage-public-url}}/<container-name>/<object-name>
Request HTTP Header
X-Auth-Token: <X-Subject-Token>
Postman collection for Object Storage:
(just set the environment variables, but token seems to stay the same across sessions)
ObjectStore.Postman_collection.json