{"id":388,"date":"2016-01-22T18:43:43","date_gmt":"2016-01-22T18:43:43","guid":{"rendered":"http:\/\/www.haxed.me.uk\/?p=388"},"modified":"2016-01-22T18:43:43","modified_gmt":"2016-01-22T18:43:43","slug":"downloading-exported-cloud-server-image-from-cloud-files-using-bashcurlapi","status":"publish","type":"post","link":"https:\/\/haxed.me.uk\/index.php\/2016\/01\/22\/downloading-exported-cloud-server-image-from-cloud-files-using-bashcurlapi\/","title":{"rendered":"Downloading exported Cloud Server Image from Cloud Files using BASH\/curl\/API"},"content":{"rendered":"<p>So, after succesfully exporting the image in the previous article, I wanted to download the VHD so I could use it on virtualbox at home. <\/p>\n<pre>\r\n#!\/bin\/bash\r\n\r\n# Username used to login to control panel\r\nUSERNAME='adambull'\r\n# Find the APIKey in the 'account settings' part of the menu of the control panel\r\nAPIKEY='mycloudapikey'\r\n# Find the image ID you'd like to make available on cloud files\r\n\r\n# Simply replace mytenantidgoeshere10011111etc with just the account number, the number given in the url in mycloud control panel! replace everything after _ so it looks like _101110\r\nTENANTID='MossoCloudFS_mytenantidgoeshereie1001111etc'\r\n\r\n# This section simply retrieves the TOKEN\r\nTOKEN=`curl https:\/\/identity.api.rackspacecloud.com\/v2.0\/tokens -X POST -d '{ \"auth\":{\"RAX-KSKEY:apiKeyCredentials\": { \"username\":\"'$USERNAME'\", \"apiKey\": \"'$APIKEY'\" }} }' -H \"Content-type: application\/json\" |  python -mjson.tool | grep -A5 token | grep id | cut -d '\"' -f4`\r\n\r\n# Download the cloud files image\r\n\r\nVHD_FILENAME=5fb64bf2-afae-4277-b8fa-0b69bc98185a.vhd\r\ncurl -o -i -X GET \"https:\/\/storage101.lon3.clouddrive.com\/v1\/$TENANTID\/exports\/$VHD_FILENAME\" \\\r\n-H \"X-Auth-Token: $TOKEN\"\r\n<\/pre>\n<p>Really really easy<\/p>\n<p>Output looks like;<\/p>\n<pre>\r\n .\/download-image-id.sh\r\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\r\n                                 Dload  Upload   Total   Spent    Left  Speed\r\n100  5143  100  5028  100   115   4470    102  0:00:01  0:00:01 --:--:--  4473\r\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\r\n                                 Dload  Upload   Total   Spent    Left  Speed\r\n  1 3757M    1 38.1M    0     0  7231k      0  0:08:52  0:00:05  0:08:47 7875k\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>So, after succesfully exporting the image in the previous article, I wanted to download the VHD so I could use it on virtualbox at home. #!\/bin\/bash # Username used to login to control panel USERNAME=&#8217;adambull&#8217; # Find the APIKey in &hellip; <a href=\"https:\/\/haxed.me.uk\/index.php\/2016\/01\/22\/downloading-exported-cloud-server-image-from-cloud-files-using-bashcurlapi\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,19,15,14,30,9],"tags":[],"class_list":["post-388","post","type-post","status-publish","format-standard","hentry","category-api","category-bash","category-cloud","category-cloud-files","category-glance-api","category-linux"],"_links":{"self":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/388","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/comments?post=388"}],"version-history":[{"count":2,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/388\/revisions"}],"predecessor-version":[{"id":452,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/posts\/388\/revisions\/452"}],"wp:attachment":[{"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/media?parent=388"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/categories?post=388"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haxed.me.uk\/index.php\/wp-json\/wp\/v2\/tags?post=388"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}