REST client?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

REST client?

Thelliez
Hello all,

I am looking for a REST client implementation.  In the Ruby world they
have rest-client (https://github.com/archiloque/rest-client) and in
the Node.js world there is restler
(https://github.com/danwrong/restler).

>From what I understand Seaside-REST is for the server side.  What do
you use for sending REST requests out?


Thanks,
Thierry
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: REST client?

Lukas Renggli
Zinc, and it is included with Pharo.

    http://homepage.mac.com/svc/Zinc-HTTP-Components/getting-started.html

Lukas

On 16 November 2011 18:21, Thierry Thelliez
<[hidden email]> wrote:

> Hello all,
>
> I am looking for a REST client implementation.  In the Ruby world they
> have rest-client (https://github.com/archiloque/rest-client) and in
> the Node.js world there is restler
> (https://github.com/danwrong/restler).
>
> >From what I understand Seaside-REST is for the server side.  What do
> you use for sending REST requests out?
>
>
> Thanks,
> Thierry
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>



--
Lukas Renggli
www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: REST client?

Sven Van Caekenberghe

On 16 Nov 2011, at 18:32, Lukas Renggli wrote:

> Zinc, and it is included with Pharo.
>
>    http://homepage.mac.com/svc/Zinc-HTTP-Components/getting-started.html

Indeed, the new ZnClient can do transparent encoding/decoding using the #contentReader: and #contentWriter: options, like this:

ZnClient new
        systemPolicy;
        url: 'http://easy.t3-platform.net/rest/geo-ip';
        queryAt: 'address' put: '81.83.7.35';
        accept: ZnMimeType applicationJson;
        contentReader: [ :entity | | parserClass |
                parserClass := Smalltalk at: #JSJsonParser ifAbsent: [ ^ self ].
                parserClass parse: entity contents ];
        ifFail: [ ^ self error: 'Oops' ];
        get.
 
If you set a #contentWriter: to convert Smalltalk to your representation, you can provide put/post data using #contents: with Smalltalk objects as arguments. The same can be done for XML, or any other (custom) encoding.

Sven_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside