Home > openstack, swift > Uploading & downloading file from Swift using curl command

Uploading & downloading file from Swift using curl command

upload a file:
curl -i $STORAGE_URL/container1/json/config -X PUT -H “X-Auth-Token:$TOKEN” -T unstack.sh

Explanation:
> the file to be created in named ‘json/config’. ‘/’ is totally valid in swift.
-T option is used to pass the data. In this case, file /json/config’ would have the data contained in unstack.sh in local filesystem.

> You have to know STORAGE_URL & TOKEN for your swift server.
for me,
$STORAGE_URL=http://192.168.2.6:8080/v1/AUTH_e61113cf15d74bfcbb4a0102d0fbc7f4
and $TOKEN = 226e5e68940743168cbbdfa9a346bd87

download a file:
curl -i $STORAGE_URL/container1/json/config -X GET -H “X-Auth-Token:$TOKEN”

Explanation:

the file name to download is ‘/json/config’. Don’t be confuse with ‘/’ in the filename. In swift you can put ‘/’ inside filename. But filename can also be as simple as ‘config’

Advertisements
Categories: openstack, swift
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: