<< Back to Swarm API Documentation
Description:
Allows you to get a collection of photos for a swarm given a swarm id.
URL:
http://api.swarmforce.com/<version>/GetPhotosBySwarm/
Return Formats:
HTTP Method(s):
POST
Requires Authentication (about authentication):
None required.
API rate limited (about rate limiting):
1 call per request
Parameters:
Response (about return values):
JSON Object (truncated):
{
[
"swarm_media_id":"370",
"user_media_id":"",
"swarm_id":"1026",
"karma":"36.288",
"dt_created":"2009-05-14 00:00:23",
"active":"1",
"twitter_users_id":"",
"flickr_users_id":"3",
"user_media_type_id":"1",
"width":"500",
"height":"333",
"file_size":"0",
"file_extension":"2",
"duration":"0",
"name":"",
"path":"",
"url":"http://farm4.static.flickr.com/3411/3530398948_e83d90bf7d.jpg?v=0",
"server":"",
"name_original":"",
"title":"TechStars Mentors Night",
"descr":"",
"validated":"1",
"large_format":"0",
"external":"1"
]
}
Usage examples:
cURL (about cURL) in PHP (about PHP):
//////////////////////////////////////////////////////////////////////////////
// make the call for photos - begin
//////////////////////////////////////////////////////////////////////////////
//set api url
$url="http://api.swarmforce.com/v1.0/GetPhotosBySwarm/";
//set arguments
$args=array("swarm_id"=>1026,"count"=>12,"version"=>1.0);
//set up call
$session = curl_init();
curl_setopt ( $session, CURLOPT_URL, $url );
curl_setopt ( $session, CURLOPT_HTTPHEADER, array('Expect:'));
curl_setopt ( $session, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt ( $session, CURLOPT_POST, 1);
//get arguments
if(count($args)>0){
$params="";
foreach($args as $key => $value){
$params.=$key."=".urlencode($value)."&";
}
$params=substr($params,0,strlen($params)-1);
curl_setopt ( $session, CURLOPT_POSTFIELDS, $params);
}
//execute call
$result_photos = curl_exec ( $session );
$photos = json_decode($result_photos);
curl_close( $session );
//////////////////////////////////////////////////////////////////////////////
// make the call for photos - end
//////////////////////////////////////////////////////////////////////////////
//now ouput
foreach($photos as $p){
echo "<BR><img src='".$p->url."' />";
}
Usage examples:
Do you have an example to share in the language of your choice? Please share!