How do I use the Unfuddle API to get files?

307 Views Asked by At

I'm new to web programming, as you are about to see.

I'm trying to periodically retrieve files from Unfuddle using their API. I tried their first code example and it seems to return valid information from my HTTP GET call, but I don't know how to use this information to get specific files onto my hard drive. How is this done?

Here is my exact HTTP GET call and response (except for the password being replaced):

bmihura@bmihura-PC ~
$ curl -i -u bmihra:password -X GET \
>   -H 'Accept: application/xml' \
>   'http://spowertech.unfuddle.com/api/v1/projects/projects.xml'
HTTP/1.1 302 Found
Server: nginx/1.0.5
Date: Fri, 17 Aug 2012 11:53:23 GMT
Content-Type: text/html; charset=utf-8
Connection: keep-alive
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.8
Vary: Accept-Encoding
Cache-Control: no-cache
Set-Cookie: authenticated=; domain=.unfuddle.com; path=/; expires=Thu, 01-Jan-19                               70 00:00:00 GMT
Set-Cookie: authenticated=false; path=/; expires=Fri, 17-Aug-2012 13:51:24 GMT
Set-Cookie: unfuddle_secure=; domain=.unfuddle.com; path=/; expires=Thu, 01-Jan-               1970 00:00:00 GMT
Set-Cookie: _unfuddle_session=; domain=.unfuddle.com; path=/; expires=Thu, 01-Ja               n-1970 00:00:00 GMT
Set-Cookie: _unfuddle_session=BAh7BjoPc2Vzc2lvbl9pZCIlZGIzOTlmMTcxZGIwZjE4MDRhZW               RkZGVmOGI4YjIxNzM%3D--0833ed386e5cd62894bb8dd787d856545897df35; path=/; expires=                           Fri, 17-Aug-2012 13:53:24 GMT; HttpOnly
Location: https://spowertech.unfuddle.com/projects/projects
Content-Length: 115
Status: 302

<html><body>You are being <a href="https://spowertech.unfuddle.com/projects/proj               ects">redirected</a>.</body></html>
1

There are 1 best solutions below

1
On

You need to use https instead of http in the url at the bottom - i.e.

curl -i -u bmihra:password -X GET \
   -H 'Accept: application/xml' \
   'https://spowertech.unfuddle.com/api/v1/projects/projects.xml'

In addition, to get it to work via my windows machine I had to replace the ' with " in the -H and remove the ' around the url. So I ended up using

curl -i -u bmihra:password -X GET \
   -H "Accept: application/xml" \
   https://spowertech.unfuddle.com/api/v1/projects/projects.xml

Hope that helps!