It is one most useful service if you are developing applications on bluemix .It provides unstructured cloud data storage. You can store and access your content using this service.
You can store your files such as pdf,txt,mp3 etc. Also you can connect to another apps and services.
How can we store files
First thing you need to have a bluemix account.Then login to your account and select your particular space.In data and analytics you can find object storage service and create it.Creating a service is nothing but an instance of that service getting created in your space.Once you create your service, create a container. This can be easily done from Manage tab.Below image shows it
Creating a container
Once the container is created you can directly upload your files using the bluemix GUI.But in the real time we need our files to be uploaded through our application may be using some rest apis..
How can we use this service through application ?
IBM Object storage is based on SWIFT api . The service uses OpenStack Identity (Keystone) for authentication and can be accessed directly by using OpenStack Object Storage (Swift) API v1 calls.
So first we need some authentication keys to be generated for this service to use through our application.
Creating service keys for authentication:
Login to your bluemix account using cloud foundry using cf login
Then use the following command:
cf create-service-key Objectstorage_servicename My-Service-Key
Now we will list this credentials since we need this by our application to authenticate to the object storage.
cf service-key My-Object-Storage My-Service-Key
Once we have these details we can focus on our application.Object storage is developed in such a away that if we want to use any api it requires an authentication token which is generated using the above values.
So the most important thing is generating a token.To generate this token we have an api for region specific where we need to perform a post call with auth details of userid,password,project_id
Below is the api for UK region and for US region we need to replace lon with dal
Using the generated token we can upload or download any file from the container.
Generating token through post man or soap ui is simple.But we need to generate this using our node js application.Below code snippet shows you how we can generate that using our node js application.
Generating this token using NODE JS Application
Once the token is generated we can interact with the object storage through our node js application. In the next blog I will show how to use this token to upload file in to object storage container through our app.
Hope it helps someone!