| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

GetPhotosBySwarm

Page history last edited by Brandon Geiger 11 years ago

<< 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: 

JSON

 

HTTP Method(s):

POST

 

Requires Authentication (about authentication):

None required.

 

API rate limited (about rate limiting):

1 call per request

 

Parameters:

  • swarm_id.  Required.  Specifies the ID of the swarm whose tweets you are trying to access. 
    • Example: 1026 (the id for the Social Revolution swarm)
  • count.  Optional.  Specifies the number of tweets to retrieve for the given call. Current maximum is 100.
  • page. Optional. Specifies the page of results to retrieve.
  • order. Optional. Specifies the order in which the results will be sorted.
    • Example: 1 - sorts by chronological order on date tweeted (not date created), 2 - sorts by karma
  • format. Optional. Specifies the requested return format. Current the only supported return format is JSON.
  • consumer_key. Optional. Specifies your application's consumer key. Does not count an API request against your IP address. Apply for one now.
  • version. Optional. Specifies the version of the Swarm API you are targeting. If no value is specified, it defaults to the most current version of the API.
    • Example: 1.12 - specifies the major version of "1" and a minor version of "12" that you are targeting

 

 

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:   

 

See Code Samples

 

 

 

Do you have an example to share in the language of your choice? Please share!

 

<< Back to Swarm API Documentation

Comments (0)

You don't have permission to comment on this page.