4.1 KiB
4.1 KiB
Update Photo
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
- permission (optional), 0 for private and 1 for public.
- title (optional), i.e. My first day at work - A string title to describe the photo.
- description (optional), i.e. A much longer description of my first day - A string to describe the photo in detail.
- tags (optional), i.e. dog,cat - A comma delimited string of alpha numeric strings.
- tagsAdd (optional), i.e. dog,cat - A comma delimited string of alpha numeric strings to be added.
- tagsRemove (optional), i.e. dog,cat - A comma delimited string of alpha numeric strings to be removed.
- dateUploaded (optional), i.e. 1311059035 - A unix timestamp of the date the photo was uploaded
- dateTaken (optional), i.e. 1311059035 - A unix timestamp of the date the photo was taken which overrides EXIF data if present
- license (optional), i.e. CC BY-SA or My Custom License - A string representing a custom or Creative Commons license.
- latitude (optional), i.e. 34.76 - A decimal representation of latitude.
- 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",
}
}