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

4.1 KiB

Update Photo


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

Purpose of the Photo update API

This API is used to update an existing photo's metadata for a user.


Endpoint

Authentication: required

POST /photo/:id/update.json

Parameters

  1. permission (optional), 0 for private and 1 for public.
  2. title (optional), e.g. My first day at work - A string title to describe the photo.
  3. description (optional), e.g. A much longer description of my first day - A string to describe the photo in detail.
  4. tags (optional), e.g. dog,cat - A comma delimited string of alpha numeric strings.
  5. tagsAdd (optional), e.g. dog,cat - A comma delimited string of alpha numeric strings to be added.
  6. tagsRemove (optional), e.g. dog,cat - A comma delimited string of alpha numeric strings to be removed.
  7. dateUploaded (optional), e.g. 1311059035 - A unix timestamp of the date the photo was uploaded
  8. dateTaken (optional), e.g. 1311059035 - A unix timestamp of the date the photo was taken which overrides EXIF data if present
  9. license (optional), e.g. CC BY-SA or My Custom License - A string representing a custom or Creative Commons license.
  10. latitude (optional), e.g. 34.76 - A decimal representation of latitude.
  11. longitude (optional), e.g. -87.45 - A decimal representation of longitude.

Examples

Command Line (using openphoto-php)

source secrets.sh
./openphoto -p -X POST -h current.openphoto.me -e /photo/a/update.json -F 'title=My Photo Title' -F 'tags=sunnyvale,downtown'

PHP (using openphoto-php)

$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->post("/photo/a/update.json", array('title' => 'My Photo Title', 'tags' => 'sunnyvale,downtown'));

Response

The response is in a standard response envelope.

  • message, A string describing the result. Don't use this for anything but reading.
  • code, 202 on success
  • result, A Photo object or FALSE on error

Sample

{
  "message":"Photo 8i uploaded successfully",
  "code":202,
  "result":{
     "id":"8i",
     "tags":[
        "dog",
        "cat"
     ],
     "pathBase":"\/base\/201107\/1311053366-huge.jpg",
     "appId":"opme",
     "host":"testjmathai1.s3.amazonaws.com",
     "dateUploadedMonth":"07",
     "status":"1",
     "hash":"6d7a9b0af31073a76ff2e79ee44b5c4951671fa2",
     "width":"4288",
     "dateTakenMonth":"07",
     "dateTakenDay":"03",
     "permission":"0",
     "pathOriginal":"\/original\/201107\/1311053366-huge.jpg",
     "exifCameraMake":"NIKON CORPORATION",
     "size":"5595",
     "dateTaken":"1309707719",
     "height":"2848",
     "views":"0",
     "dateUploadedYear":"2011",
     "dateTakenYear":"2011",
     "creativeCommons":"BY-NC",
     "dateUploadedDay":"18",
     "dateUploaded":"1311053403",
     "exifCameraModel":"NIKON D90",
     "longitude":"-89.24",
     "latitude":"37.65",
     "path300x300":"\/custom\/201107\/1311053366-huge_300x300.jpg",
  }
}