views:

4614

answers:

4

i want to display whatever the response of flickr.test.echo was on the page using rest (jquery ajax - because thats what im using)

i need to supply an api_key


The REST Endpoint URL is http://api.flickr.com/services/rest/

To request the flickr.test.echo service, invoke like this:

http://api.flickr.com/services/rest/?method=flickr.test.echo&name=value

By default, REST requests will send a REST response.

To return the response in REST format, send a parameter "format" in the request with a value of "rest". When using the REST request method, the response defaults to REST.

A method call returns this:

[xml-payload-here]

If an error occurs, the following is returned:

i got that from here http://www.flickr.com/services/api/request.rest.html


This is the method im interested in http://www.flickr.com/services/api/flickr.test.echo.html

please help.

+1  A: 

I'm not sure how you're going to retrieve their data with Ajax, since Ajax doesn't work cross-domain.

Have you seen their $.getJSON demo? http://docs.jquery.com/Ajax/jQuery.getJSON

It lets you specify a callback and returns json wrapped as a parameter inside an automatically generated function. It works cross-domain as well.

Luca Matteis
+1  A: 

Use Flickr's JSON format API and jQuery.getJSON like sktrdie suggested - just remember to append callback=? to the url to wrap it in JSONP.

From the jQuery.getJSON docs:

$.getJSON("http://api.flickr.com/services/feeds/photos_public.gnetags=cat&tagmode=any&format=json&callback=?",
    function(data){
      $.each(data.items, function(i,item){
        $("<img/>").attr("src", item.media.m).appendTo("#images");
        if ( i == 4 ) return false;
      });
    });
orip
A: 

thanks to both of you!

A Hassan
+1  A: 

I would just use the jQuery Flickr plugin, alot easier! :)