8 November 2013

Using cURL to upload to Rackspace Cloud Files

Posted by Christoph under: Rackspace .

In this post, I will show you how to quickly upload files to Rackspace Cloud Files using only the Linux CLI (i.e., no SDKs, Rackspace-specific tools, or anything that is not already installed on a standard Linux distro).

This post will assume you already have some basic understanding of how application programming interfaces (APIs) work, you have a Rackspace Cloud account (w/Cloud Files), and understand the basics of the Linux CLI (e.g., you know how to use cURL). See my Rackspace API article on my wiki for more in-depth explanations and examples.

Note: The following commands use Python. It should work with any version of Python, however, it was tested with Python 2.7.4.

First get your 24-hour-valid token:

Then, use a for-loop to upload your files (e.g., all of the PNG files in you present working direcory) to a given container (e.g., “sandbox”):

Note: Obviously, you will need to replace MossoCloudFS_ffff-ffff-ffff-ffff-ffff with your actual unique container URL.

Share Button