How do I POST/GET from rails to API with either ActiveResource or rest-client (preferred)?
Posted
by Angela
on Stack Overflow
See other posts from Stack Overflow
or by Angela
Published on 2010-05-09T01:15:35Z
Indexed on
2010/05/11
2:44 UTC
Read the original article
Hit count: 302
postful
|restful-web-services
Hi, this is a pretty basic question but I'm not entirely clear how to do this.
I am trying to use a third-party service that has RESTful service. The service is called Postful. But I'm not clear what exactly to do?
I've looked at ActiveResource (http://api.rubyonrails.org/classes/ActiveResource/Base.html) and rest-client, but I'm still not clear exactly what steps, code, and files to create.
http://www.postful.com/service/mail is one of the services (details found http://www.postful.com/developer/guide#rest ), but to upload an image I have to post the following (but I'm not sure how I actually do this?). Thanks!
> http://www.postful.com/service/upload
>
> Be sure to include the Content-Type
> and Content-Length headers and the
> image itself as the body of the
> request.
>
> POST /upload HTTP/1.0 Content-Type:
> application/octet-stream
> Content-Length: 301456
>
> ... file content here ...
>
> If the upload is successful, you will
> receive a response like the following:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <upload>
> <id>290797321.waltershandy.2</id>
> </upload>
© Stack Overflow or respective owner