Has anyone got any examples of how to use the REST resource asset?
And …
Has anyone got any examples of how to process the xml response from the REST resource asset? The manual isn't terribly helpful in this regard.
[quote]
Has anyone got any examples of how to use the REST resource asset?
And …
Has anyone got any examples of how to process the xml response from the REST resource asset? The manual isn't terribly helpful in this regard.
[/quote]
Hi Michael,
If you want to process the response you have to use the REST resource JavaScript
As an example put this flickr api call into the URL:
http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=212c6c37c1cc541fc7005e37404374ae&text=squiz&per_page=10
And this JS into the JavaScipt box:
var xml = XML(_REST.response.bodyx),
pics = xml.photos.photo;
//for debug:
print ("<!-- back from flickr: " + pics + " -->");
print ("<dl>");
for (var el in pics) {
print ("<dt>" + pics[el].@title + "</dt>");
print ("<dd><img src='http://farm" + pics[el].@farm + ".static.flickr.com/" + pics[el].@server + "/" +
pics[el].@id + "_" + pics[el].@secret + "_t.jpg' alt='" + pics[el].@title + "' title='" + pics[el].@title + "' /></dd>");
}
print ("</dl>");
Which uses the E4X js extension to print an definition list of photos and titles.
Hopefully this will get you started.
Steve
[quote]
Hi Michael,
If you want to process the response you have to use the REST resource JavaScript
[/quote]
Hi Steve
Thanks for this. Exactly what I was looking for!
Michael