photo-documentation/docs/api/GetPhotos.markdown
2013-01-29 11:10:50 -05:00

4.7 KiB

Get Photos


  1. Purpose
  2. Endpoint
  3. Parameters
  4. Examples
  1. Response

Purpose of the Get Photos API

Use this API to get a set of photos for a user.

NOTE: Always pass in the returnSizes parameter for sizes you plan on using. It's the only way to guarantee that a URL for that size will be present in the response. See Photo Generation for details.


Endpoint

Authentication: optional

GET /photos.json

Parameters

  1. returnSizes (optional), (e.g. 20x20 or 30x30xCR,40x40) The photo sizes you'd like in the response. Specify every size you plan on using. Docs for this parameter
  2. generate (optional), (i.e. true or false) Tells the API to generate the sizes from returnSizes instead of returning a create URL. Docs for this parameter
  3. pageSize (optional), Number of photos to return per request.
  4. page (optional), Page number when browsing through photos. Starts at 1.
  5. tags (optional), e.g. dog,cat - A comma delimited string of strings.

Examples

Command Line (using openphoto-php)

./openphoto -p -h current.openphoto.me -e /photos/list.json -F 'tags=sunnyvale'

PHP (using openphoto-php)

$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->get("/photos/list.json", array('tags' => 'sunnyvale'));

Response

The response is in a standard response envelope.

  • message, A string describing the result. Don't use this for anything but reading.
  • code, 200 on success
  • result, An array of Photo objects

Sample

{
  "message":"",
  "code":200,
  "result":[
    {
      "tags":[
         ""
      ],
      "pathBase":"\/base\/201107\/1311045184-opme7Z0WBh.jpg",
      "appId":"opme",
      "host":"testjmathai1.s3.amazonaws.com",
      "dateUploadedMonth":"07",
      "status":"1",
      "hash":"fba49a238426ac3485af6d69967ccd2d08c1fe5c",
      "width":"569",
      "dateTakenMonth":"07",
      "dateTakenDay":"18",
      "permission":"0",
      "pathOriginal":"\/original\/201107\/1311045184-opme7Z0WBh.jpg",
      "exifCameraMake":"",
      "size":"0",
      "dateTaken":"1311045184",
      "height":"476",
      "views":"0",
      "dateUploadedYear":"2011",
      "dateTakenYear":"2011",
      "creativeCommons":"BY-NC",
      "dateUploadedDay":"18",
      "dateUploaded":"1311045188",
      "exifCameraModel":"",
      "path200x200":"\/custom\/201107\/1311045184-opme7Z0WBh_200x200.jpg",
      "id":"hl"
    },
    {
      "tags":[
         ""
      ],
      "pathBase":"\/base\/201107\/1311027064-opme0WBhqP.jpg",
      "appId":"opme",
      "host":"testjmathai1.s3.amazonaws.com",
      "dateUploadedMonth":"07",
      "status":"1",
      "hash":"fba49a238426ac3485af6d69967ccd2d08c1fe5c",
      "width":"569",
      "dateTakenMonth":"07",
      "dateTakenDay":"18",
      "permission":"0",
      "pathOriginal":"\/original\/201107\/1311027064-opme0WBhqP.jpg",
      "exifCameraMake":"",
      "size":"0",
      "dateTaken":"1311027064",
      "height":"476",
      "views":"0",
      "dateUploadedYear":"2011",
      "dateTakenYear":"2011",
      "creativeCommons":"BY-NC",
      "dateUploadedDay":"18",
      "dateUploaded":"1311027066",
      "exifCameraModel":"",
      "id":"ob"
    }
  ]
}