photo-front/documentation/api/PostPhotoUpdate.markdown
2011-12-03 20:55:00 -08:00

3.9 KiB

Open Photo API / Update Photo

OpenPhoto, a photo service for the masses


  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), i.e. My first day at work - A string title to describe the photo.
  3. description (optional), i.e. A much longer description of my first day - A string to describe the photo in detail.
  4. tags (optional), i.e. dog,cat - A comma delimited string of alpha numeric strings.
  5. dateUploaded (optional), i.e. 1311059035 - A unix timestamp of the date the photo was uploaded
  6. dateTaken (optional), i.e. 1311059035 - A unix timestamp of the date the photo was taken which overrides EXIF data if present
  7. license (optional), i.e. CC BY-SA or My Custom License - A string representing a custom or Creative Commons license.
  8. latitude (optional), i.e. 34.76 - A decimal representation of latitude.
  9. longitude (optional), i.e. -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",
  }
}