Querying the dataset
You can access the picture streams of individual users by issuing a HTTP GET request with the following URI:
http://passingpix.com/<username>.jsonTo access the stream of all the latest links use
http://passingpix.com/new.json
The response looks like this:
{
// Only if a user's stream is requested
"user": "Anonymous",
// Array containing one element for each link.
// It can contain 0-40 elements.
// But the maximum number may change in the future.
// So make sure your code handles a greater number of elements.
"links": [
{
// Absolute address of the 75x75 pixels thumbnail
"thumb": "http://passingpix.com/tb/djiLK32-3k4.jpg",
// Absolute address of the bigger thumbnail that
// is not cropped (shortest side: <=150px)
"full": "http://passingpix.com/tf/djiLK32-3k4.jpg",
// Absolute address of the target link
"link": "http://passingpix.com/v/djiLK32-3k4",
// HTML-safe UTF-8 comment for this link.
// It is omitted if there is no message for this picture.
"msg": "Hello World!",
// Epoch time when the link was submitted
"time": "1234567890",
// Name of the user who submitted the link.
// Only if cumulative data was requested
"user": "Anonymous",
}
]
}
Querying the dataset++
You can also request that the response is wrapped as parameter in a JavaScript callback:http://passingpix.com/new.json?callback=MyFunctionThe response will change accordingly:
MyFunction({ /* content as above */ })
Example: a web page that displays the 5 latest pictures.
<html> <head> <script type="text/javascript"> function MyFunction(stream) { for (var i = 0; i < 5 && stream.links[i]; ++i) { var p = stream.links[i]; document.write( '<a href="' + p.link + '">' + '<img src="' + p.thumb + '" title="' + (p.msg||'') + '">' + '</a>' ); } } </script> </head> <body> <script type="text/javascript" src="http://passingpix.com/new.json?callback=MyFunction"> </script> </body> </html>
And that's how it looks (with the right CSS applied):