Initial checkin of docs

This commit is contained in:
Jaisen Mathai 2013-01-28 22:49:14 -05:00
commit f22ce1ca1d
61 changed files with 5061 additions and 0 deletions

View file

@ -0,0 +1,27 @@
Authentication using OAuth 1.0a
=======================
### Using OAuth (1.0a)
A full introduction to OAuth is beyond the scope of the OpenPhoto documentation.
In all reality you probably don't need to understand the ins and outs of OAuth, just grab one of our libraries.
* <a href="https://github.com/photo/openphoto-php">openphoto/openphoto-php</a> - Our PHP language binding.
* <a href="https://github.com/photo/openphoto-ruby">openphoto/openphoto-ruby</a> - Our Ruby language binding.
* <a href="https://github.com/photo/openphoto-python">openphoto/openphoto-python</a> - Our Python language binding.
* <a href="https://github.com/photo/openphoto-java">openphoto/openphoto-java</a> - Our Java language binding.
* More coming soon, <a href="mailto:hello@openphoto.me">contact us</a> if you'd like to write bindings in an unlisted language.
### Obtaining a consumer key and secret
Since OpenPhoto is distributed the flow to obtain a consumer key and secret differs slightly from typical OAuth applications.
Typically you would sign up for an application ID and be given a key and secret to be used with your app.
OpenPhoto differs because the host you'll be sending requests to is arbitrary and there's no central application repository.
### Resources on the web
If you're interested in learning more about OAuth then the following links are a great place to start.
* http://oauth.net/documentation/getting-started/
* http://hueniverse.com/oauth/guide/intro/
* http://www.slideshare.net/eran/introduction-to-oauth-presentation

View file

@ -0,0 +1,41 @@
Response Envelope
=======================
----------------------------------------
### Standard OpenPhoto API response envelope
Every API returns a JSON response adhering to the following format.
{
message: (string),
code: (int),
result: (mixed)
}
#### Message
The _message_ is a string which describes the action taken.
It's purely for informational purposes and should never be used in your code or relied on.
#### Code
The _code_ is an integer representing the status of the API call.
Typically the _code_ value should be _200_ but anything between _200_ and _299_ indicates a successful response.
The photo upload API, for example, will return a _202_ response indicating that the resource has been created.
Below are some common codes:
* _200_, The API call was successful
* _202_, Resource was created successfully
* _403_, Authentication failed when trying to complete the API call
* _404_, The requested endpoint could not be found
* _500_, An unknown error occured and hopefully the message has more information
#### Result
The _result_ can be any simple or complex value.
Consult the documentation for the endpoint you're using for information on what the _result_ will be.
The purpose of the _result_ is to allow you to continue processing the request.
We'll try to return the information you'll most likely need and aim to keep you from having to make a subsequent call to get it.

View file

@ -0,0 +1,173 @@
Get Activities
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the Get Activities API
Use this API to get a user's activity feed.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: optional_
GET /activities/list.json
<a name="parameters"></a>
### Parameters
1. groupBy (optional), Time period to group activities by
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
./openphoto -p -h current.openphoto.me -e /activities/list.json
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->get("/tags/activities.json");
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _200_ on success
* _result_, An array of activities
<a name="sample"></a>
#### Sample without `groupBy`
{
"message" : "User's list of activities",
"code" : 200,
"result" : [
{ // Photo object
"id" : "l", // activity id, not photo id. See photo object for photo id
"owner" : "jaisen+test@jmathai.com",
"appId" : "openphoto-frontend",
"type" : "photo-upload",
"data" : {
// Photo object
}
},
{ // comment
"id" : "p", // activity id, not photo id. See photo object for photo id
"owner" : "jaisen+test@jmathai.com",
"appId" : "openphoto-frontend",
"type" : "action-create",
"data" : {
"targetType" : "photo",
"target" : {
// Photo object
},
"action" : {
// Action object
}
},
"permission" : "1",
"dateCreated" : "1328851975"
}
]
}
#### Sample with `groupBy`
{
"message" : "User's list of activities",
"code" : 200,
"result" : {
"2012020921-photo-upload" : [ // photo uploads
{
"id" : "l", // activity id, not photo id. See photo object for photo id
"type" : "photo-upload",
"data" : {
// Photo object
},
"permission" : "1",
"dateCreated" : "1328851361"
},
{
"id" : "m", // activity id, not photo id. See photo object for photo id
"type" : "photo-upload",
"data" : {
// Photo object
},
"permission" : "1",
"dateCreated" : "1328851363"
}
],
"2012020921-action-create" : [
{
"id" : "p", // activity id, not photo id. See photo object for photo id
"type" : "action-create",
"data" : {
"targetType" : "photo",
"target" : {
// Photo object
},
"action" : {
// Action object
}
},
"permission" : "1",
"dateCreated" : "1328851975"
},
{
"id" : "q", // activity id, not photo id. See photo object for photo id
"owner" : "jaisen+test@jmathai.com",
"appId" : "openphoto-frontend",
"type" : "action-create",
"data" : {
"targetType" : "photo",
"target" : {
// Photo object
},
"action" : {
// Action object
}
},
"permission" : "1",
"dateCreated" : "1328852131"
}
]
}
}
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,93 @@
Get Group
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the Get Group API
Use this API to get a user's group.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
GET /group/:id/view.json
<a name="parameters"></a>
### Parameters
_None_
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
source secrets.sh
./openphoto -p -h current.openphoto.me -e /group/d/view.json
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->get("/group/d/view.json");
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _200_ on success
* _result_, A [Group][Group] object
<a name="sample"></a>
#### Sample
{
"message" : "Your group",
"code" : 200,
"result" : {
"id" : "d",
"Name" : "d",
"name" : "Rachel and Jaisen",
"members" : [
"rachel.mathai@yahoo.com",
"jaisen@jmathai.com"
],
"appId" : "openphoto-frontend"
}
}
[Group]: http://theopenphotoproject.org/documentation/schemas/Group
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

115
docs/api/GetGroups.markdown Normal file
View file

@ -0,0 +1,115 @@
Get Groups
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the Get Groups API
Use this API to get a list of the user's groups.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
GET /groups/list.json
<a name="parameters"></a>
### Parameters
_None_
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
source secrets.sh
./openphoto -p -h current.openphoto.me -e /groups/list.json
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->get("/groups/list.json");
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _200_ on success
* _result_, An array of [Group][Group] objects
<a name="sample"></a>
#### Sample
{
"message" : "A list of your groups",
"code" : 200,
"result" : [
{
"id" : "e",
"Name" : "e",
"name" : "Everyone else",
"members" : [
"rachel.mathai@yahoo.com",
"jaisen@jmathai.com",
"joe@joe.com"
],
"appId" : "openphoto-frontend"
},
{
"id" : "d",
"Name" : "d",
"name" : "Rachel and Jaisen",
"members" : [
"rachel.mathai@yahoo.com",
"jaisen@jmathai.com"
],
"appId" : "openphoto-frontend"
},
{
"id" : "f",
"Name" : "f",
"name" : "Random",
"members" : [
"joe@joe.com"
],
"appId" : "openphoto-frontend"
}
]
}
[Group]: http://theopenphotoproject.org/documentation/schemas/Group
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,94 @@
Hello World
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the Get Hello World API
This endpoint is used to test connectivity and/or authentication. Any parameters passed in the query string are returned in the response.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: optional_
GET /hello.json
<a name="parameters"></a>
### Parameters
1. auth (optional), Pass this in with a value of `true` to test OAuth requests.
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
# without authentication
./openphoto -p -h current.openphoto.me -e /hello.json
# with authentication
./openphoto -p -h current.openphoto.me -e /hello.json -F 'auth=true'
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
// without authentication
$client = new OpenPhotoOAuth($host);
$response = $client->get("/hello.json");
// with authentication
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->get("/hello.json", array('auth' => 'true'));
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _200_ on success
* _result_, Any GET parameters passed in to the request plus `__route__`.
<a name="sample"></a>
#### Sample
{
"message":"Hello, world!",
"code":200,
"result":
{
"__route__":"\/hello.json"
}
}
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

116
docs/api/GetPhoto.markdown Normal file
View file

@ -0,0 +1,116 @@
Get Photo
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the Get Photo API
Use this API to get a for a user's photo.
_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](http://theopenphotoproject.org/documentation/faq/PhotoGeneration) for details.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: optional_
GET /photo/:id/view.json
<a name="parameters"></a>
### Parameters
1. returnSizes (optional), (i.e. 20x20 or 30x30xCR,40x40) The photo sizes you'd like in the response. Specify every size you plan on using. [Docs for this parameter](http://theopenphotoproject.org/documentation/faq/ReturnSizes)
1. 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](http://theopenphotoproject.org/documentation/faq/ReturnSizes)
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
./openphoto -p -h current.openphoto.me -e /photo/b/view.json
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->get("/photo/b/view.json");
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _200_ on success
* _result_, A [Photo][Photo] object
<a name="sample"></a>
#### Sample
{
"message":"",
"code":200,
"result":{
"id":"hl"
"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",
}
}
[Photo]: http://theopenphotoproject.org/documentation/schemas/Photo
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[photogeneration]: http://theopenphotoproject.org/documentation/faq/PhotoGeneration
[ReturnSizes]: http://theopenphotoproject.org/documentation/faq/ReturnSizes
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,159 @@
Get Next/Previous Photo
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the Get Photo API
Use this API to get the next and previous photo given a photo in the middle.
_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](http://theopenphotoproject.org/documentation/faq/PhotoGeneration) for details.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: optional_
GET /photo/:id/nextprevious.json
<a name="parameters"></a>
### Parameters
1. returnSizes (optional), (i.e. 20x20 or 30x30xCR,40x40) The photo sizes you'd like in the response. Specify every size you plan on using. [Docs for this parameter](http://theopenphotoproject.org/documentation/faq/ReturnSizes)
1. 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](http://theopenphotoproject.org/documentation/faq/ReturnSizes)
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
./openphoto -p -h current.openphoto.me -e /photo/b/nextprevious.json
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->get("/photo/b/nextprevious.json");
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _200_ on success
* _result_, An array of [Photo][Photo] objects
<a name="sample"></a>
#### Sample
{
"message" : "Next\/previous for photo bq",
"code" : 200,
"result" : {
"previous" : {
"tags" : [
],
"id" : "bo",
"appId" : "openphoto-frontend",
"pathBase" : "\/base\/201109\/1317155744-DSC_9243.JPG",
"dateUploadedMonth" : "09",
"dateTakenMonth" : "08",
"exifCameraMake" : "NIKON CORPORATION",
"dateTaken" : "1313454314",
"title" : "",
"height" : "2000",
"description" : "",
"dateTakenYear" : "2011",
"longitude" : "",
"dateUploadedDay" : "27",
"host" : "opmecurrent.s3.amazonaws.com",
"hash" : "7b923cbbe4f7aa81be144b1420a99711ad57106b",
"status" : "1",
"width" : "3008",
"dateTakenDay" : "15",
"permission" : "1",
"pathOriginal" : "\/original\/201109\/1317155744-DSC_9243.JPG",
"size" : "2502",
"dateUploadedYear" : "2011",
"views" : "0",
"latitude" : "",
"dateUploaded" : "1317155745",
"exifCameraModel" : "NIKON D70s",
"Name" : "bo",
"exifFocalLength" : "35",
"exifExposureTime" : "10\/600",
"exifISOSpeed" : "",
"license" : "",
"exifFNumber" : "3.8"
},
"next" : {
"tags" : [
],
"id" : "63",
"appId" : "current.openphoto.me",
"pathBase" : "\/base\/201108\/1313010849-opmeTbrBki.jpg",
"dateUploadedMonth" : "08",
"dateTakenMonth" : "08",
"exifCameraMake" : "",
"dateTaken" : "1313010850",
"title" : "Gulf Shores, AL",
"height" : "1936",
"description" : "",
"creativeCommons" : "BY-NC",
"dateTakenYear" : "2011",
"dateUploadedDay" : "10",
"longitude" : "-87.7008193",
"host" : "opmecurrent.s3.amazonaws.com",
"hash" : "20d64642f09befc4004c22269e698e6e43475963",
"status" : "1",
"width" : "2592",
"dateTakenDay" : "10",
"permission" : "1",
"pathOriginal" : "\/original\/201108\/1313010849-opmeTbrBki.jpg",
"size" : "1513",
"dateUploadedYear" : "2011",
"views" : "0",
"latitude" : "30.2460361",
"dateUploaded" : "1313010853",
"exifCameraModel" : "",
"Name" : "63"
}
}
}
[Photo]: http://theopenphotoproject.org/documentation/schemas/Photo
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[photogeneration]: http://theopenphotoproject.org/documentation/faq/PhotoGeneration
[ReturnSizes]: http://theopenphotoproject.org/documentation/faq/ReturnSizes
[openphoto-php]: https://github.com/photo/openphoto-php

149
docs/api/GetPhotos.markdown Normal file
View file

@ -0,0 +1,149 @@
Get Photos
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### 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](http://theopenphotoproject.org/documentation/faq/PhotoGeneration) for details.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: optional_
GET /photos.json
<a name="parameters"></a>
### Parameters
1. returnSizes (optional), (i.e. 20x20 or 30x30xCR,40x40) The photo sizes you'd like in the response. Specify every size you plan on using. [Docs for this parameter](http://theopenphotoproject.org/documentation/faq/ReturnSizes)
1. 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](http://theopenphotoproject.org/documentation/faq/ReturnSizes)
1. pageSize (optional), Number of photos to return per request.
1. page (optional), Page number when browsing through photos. Starts at 1.
1. tags (optional), _i.e. dog,cat_ - A comma delimited string of strings.
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
./openphoto -p -h current.openphoto.me -e /photos/list.json -F 'tags=sunnyvale'
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->get("/photos/list.json", array('tags' => 'sunnyvale'));
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _200_ on success
* _result_, An array of [Photo][Photo] objects
<a name="sample"></a>
#### 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"
}
]
}
[Photo]: http://theopenphotoproject.org/documentation/schemas/Photo
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[photogeneration]: http://theopenphotoproject.org/documentation/faq/PhotoGeneration
[ReturnSizes]: http://theopenphotoproject.org/documentation/faq/ReturnSizes
[openphoto-php]: https://github.com/photo/openphoto-php

107
docs/api/GetTags.markdown Normal file
View file

@ -0,0 +1,107 @@
Get Tags
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the Get Tags API
Use this API to get a user's tags.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: optional_
GET /tags/list.json
<a name="parameters"></a>
### Parameters
_None_
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
./openphoto -p -h current.openphoto.me -e /tags/list.json
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->get("/tags/list.json");
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _200_ on success
* _result_, An array of [Tag][Tag] objects
<a name="sample"></a>
#### Sample
{
"message":"",
"code":200,
"result":
[
{
"id": "mountain",
"count": 1
},
{
"id": "jaisen",
"count": 10,
"email": "jaisen@jmathai.com"
},
{
"id": "New York",
"count": 9,
"latitude": 12.3456,
"longitude": 78.9012
},
{
"id": "Sunnyvale",
"count":23
"latitude": 13.579,
"longitude": 24.68
},
....
]
}
[Tag]: http://theopenphotoproject.org/documentation/schemas/Tag
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,92 @@
Get Webhook
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the GET Webhook API
Use this API to get a user's Webhook.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
GET /webhook/:id/view.json
<a name="parameters"></a>
### Parameters
_None_
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
source secrets.sh
./openphoto -p -h current.openphoto.me -e /webhook/abcdefghijklmnopqrstuvwxyz/view.json
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->get("/webhook/abcdefghijklmnopqrstuvwxyz/view.json");
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _200_ on success
* _result_, A [Webhook][Webhook] object
<a name="sample"></a>
#### Sample
{
"message" : "Your group",
"code" : 200,
"result" : {
id: "abcdefghijklmnopqrstuvwxyz",
appId: "current.openphoto.me",
callback: "http://somehost.com/somepath",
topic: "photo.upload",
verifyToken: "qazwsxedcrfvz",
challenge: "plmoknijbuhv",
secret: "rfvtgbyhn"
}
}
[Webhook]: http://theopenphotoproject.org/documentation/schemas/Webhook
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1 @@
Not yet documented

View file

@ -0,0 +1,100 @@
Create Action
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the create action API
Use this API to create an action on a photo. This includes comments and favorites.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
POST /action/:targetId/photo/create.json
<a name="parameters"></a>
### Parameters
1. email (required), Email address of the user performing this action
1. name (optional), Name of the user performing this action
1. website (optional), URL of the user performing this action
1. targetUrl (optional), URL of the object this action is being performed on
1. permalink (optional), Permalink URL of this action
1. type (required), _i.e. comment or favorite_ - Type of action
1. value (required), Text representing the comment or favorite
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
./openphoto -p -X POST -h current.openphoto.me -e /action/photo/a/create.json -F 'type=comment' -F 'value=Here is my comment' -F 'email=jaisen@jmathai.com'
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->post("/action/photo/a/create.json", array('type' => 'comment', 'value' => 'Here is my comment', 'email' => 'jaisen@jmathai.com'));
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _200_ on success
* _result_, A [Action][Action] object or FALSE on error
<a name="sample"></a>
#### Sample
{
"message":"",
"code":200,
"result":
{
id: "a",
appId: "current.openphoto.me",
targetId: "b",
targetType: "photo",
email: "jaisen@jmathai.com",
type: "comment",
value: "Here is my comment",
datePosted: "1318281477",
status: 1
}
}
[Action]: http://theopenphotoproject.org/documentation/schemas/Action
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,83 @@
Delete Action
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the delete action API
Use this API to delete an action on a photo. This includes comments and favorites.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
POST /action/photo/:targetId/delete.json
<a name="parameters"></a>
### Parameters
_N/A_
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
./openphoto -p -X POST -h current.openphoto.me -e /action/photo/a/delete.json
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->post("/action/photo/a/delete.json");
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _204_ on success
* _result_, boolean
<a name="sample"></a>
#### Sample
{
"message":"",
"code":204,
"result": true
}
[Action]: http://theopenphotoproject.org/documentation/schemas/Action
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,90 @@
Create Group
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the create Group API
Use this API to create a group.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
POST /group/create.json
<a name="parameters"></a>
### Parameters
1. name (required), The name of the group to create
1. members (optional), _i.e. jaisen@jmathai.com,hello@openphoto.me_ - A comma delimited list of email addresses
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
./openphoto -p -X POST -h current.openphoto.me -e /group/create.json -F 'name=My Group' -F 'members=jaisen@jmathai.com'
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->post("/group/create.json", array('name' => 'My Group', 'members' => 'jaisen@jmathai.com'));
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _200_ on success
* _result_, A [Group][Group] object or FALSE on error
<a name="sample"></a>
#### Sample
{
"message":"",
"code":200,
"result":
{
id: 'a',
appId: 'current.openphoto.me',
name: 'My Group',
members: ['jaisen@jmathai.com','hello@openphoto.me']
}
}
[Group]: http://theopenphotoproject.org/documentation/schemas/Group
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,83 @@
Delete Group
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the delete Group API
Use this API to delete a group.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
POST /group/:id/delete.json
<a name="parameters"></a>
### Parameters
_None_
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
./openphoto -p -X POST -h current.openphoto.me -e /group/a/delete.json
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->post("/group/a/delete.json");
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _204_ on success
* _result_, A boolean
<a name="sample"></a>
#### Sample
{
"message":"",
"code":204,
"result": true
}
[Group]: http://theopenphotoproject.org/documentation/schemas/Group
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,90 @@
Update Group
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the update Group API
Use this API to update a group.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
POST /group/:id/update.json
<a name="parameters"></a>
### Parameters
1. name (optional), The name of the group to create
1. members (optional), _i.e. jaisen@jmathai.com,hello@openphoto.me_ - A comma delimited list of email addresses
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
./openphoto -p -X POST -h current.openphoto.me -e /group/a/update.json -F 'members=jaisen@jmathai.com'
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->post("/group/a/update.json", array('members' => 'jaisen@jmathai.com'));
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _200_ on success
* _result_, A [Group][Group] object or FALSE on error
<a name="sample"></a>
#### Sample
{
"message":"",
"code":200,
"result":
{
id: 'a',
appId: 'current.openphoto.me',
name: 'My Group',
members: ['jaisen@jmathai.com']
}
}
[Group]: http://theopenphotoproject.org/documentation/schemas/Group
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,82 @@
Delete Photo
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the delete action API
Use this API to delete an action.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
POST /action/:id/delete.json
<a name="parameters"></a>
### Parameters
_None_
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
./openphoto -p -X POST -h current.openphoto.me -e /action/a/delete.json
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->post("/action/a/delete.json");
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _204_ on success
* _result_, Boolean
<a name="sample"></a>
#### Sample
{
"message":"",
"code":204,
"result":true
}
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,125 @@
Update Photo
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the Photo update API
This API is used to update an existing photo's metadata for a user.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
POST /photo/:id/update.json
<a name="parameters"></a>
### Parameters
1. permission (optional), 0 for private and 1 for public.
1. title (optional), _i.e. My first day at work_ - A string title to describe the photo.
1. description (optional), _i.e. A much longer description of my first day_ - A string to describe the photo in detail.
1. tags (optional), _i.e. dog,cat_ - A comma delimited string of alpha numeric strings.
1. tagsAdd (optional), _i.e. dog,cat_ - A comma delimited string of alpha numeric strings to be added.
1. tagsRemove (optional), _i.e. dog,cat_ - A comma delimited string of alpha numeric strings to be removed.
1. dateUploaded (optional), _i.e. 1311059035_ - A unix timestamp of the date the photo was uploaded
1. dateTaken (optional), _i.e. 1311059035_ - A unix timestamp of the date the photo was taken which overrides EXIF data if present
1. license (optional), _i.e. CC BY-SA or My Custom License_ - A string representing a custom or Creative Commons license.
1. latitude (optional), _i.e. 34.76_ - A decimal representation of latitude.
1. longitude (optional), _i.e. -87.45_ - A decimal representation of longitude.
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][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'
<a name="example-php"></a>
#### PHP (using [openphoto-php][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'));
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _202_ on success
* _result_, A [Photo][Photo] object or FALSE on error
<a name="sample"></a>
#### 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",
}
}
[Photo]: http://theopenphotoproject.org/documentation/schemas/Photo
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,139 @@
Upload Photo
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the Photo Upload API
This API is used to upload a new photo for a user.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
POST /photo/upload.json
<a name="parameters"></a>
### Parameters
(Due to a [bug in PHP's PECL OAuth extension](https://github.com/photo/frontend/issues/289) all parameters except for the photo must be passed urlencoded in the query string. This only applies for multipart and not application/x-www-form-urlencoded requests).
1. photo (required), The photo to be uploaded.
* This can be the binary photo in multipart/formdata
* This can be the base64 encoded value of the photo in application/x-www-form-urlencoded
1. permission (optional), 0 for private and 1 for public.
1. title (optional), _e.g. My first day at work_ - A string title to describe the photo.
1. description (optional), _e.g. A much longer description of my first day_ - A string to describe the photo in detail.
1. tags (optional), _e.g. dog,cat_ - A comma delimited string of alpha numeric strings.
1. dateUploaded (optional), _i.e. 1311059035_ - A unix timestamp of the date the photo was uploaded
1. dateTaken (optional), _e.g. 1311059035_ - A unix timestamp of the date the photo was taken which overrides EXIF data if present
1. license (optional), _e.g. CC BY-SA or My Custom License_ - A string representing a custom or Creative Commons license.
1. latitude (optional), _e.g. 34.76_ - A decimal representation of latitude.
1. longitude (optional), _e.g. -87.45_ - A decimal representation of longitude.
1. returnSizes (optional), _e.g. 200x200,300x300xBW_ - A string instructing specific versions of the photo to be autogenerated.
To specify multiple sizes then separate each with a comman.
The url will be present in the response.
* 300x300 - A photo which maintains aspect ratio and fits inside a 300x300 square
* 1024x768xCR - A photo that's exactly 1024x768 pixels cropped to the center in an optimized manner
* 160x90xBWxCR - A photo that's cropped exactly to 160x90 in greyscale (black and white)
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
source secrets.sh
./openphoto -p -X POST -h current.openphoto.me -e /photo/upload.json -F 'photo=@/path/to/photo.jpg' -F 'tags=sunnyvale,downtown'
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
// multipart
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->post("/photo/upload.json", array('photo' => '@/path/to/photo.jpg', 'tags' => 'sunnyvale,downtown'));
// base64 encoded
$photoBase64Encoded = base64_encode(file_get_contents('/path/to/photo.jpg'));
$response = $client->post("/photo/upload.json", array('photo' => $photoBase64Encoded, 'tags' => 'sunnyvale,downtown'));
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _202_ on success
* _result_, A [Photo][Photo] object
<a name="sample"></a>
#### 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",
}
}
[Photo]: http://theopenphotoproject.org/documentation/schemas/Photo
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,92 @@
Create Tag
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the Create Tag API
Use this API to create a tag.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
POST /tag/create.json
<a name="parameters"></a>
### Parameters
1. tag (required), The name of the tag to create
1. count (optional), Number of photos which contain this tag
1. email (optional), An email address that corresponds to this tag
1. latitude (optional), _i.e. 34.76_ - A decimal representation of latitude.
1. longitude (optional), _i.e. -87.45_ - A decimal representation of longitude.
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
./openphoto -p -X POST -h current.openphoto.me -e /tag/create.json -F 'tag=sunnyvale' -F 'count=10'
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->post("/tag/create.json", array('tag' => 'sunnyvale', 'count' => 10));
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _201_ on success
* _result_, A [Tag][Tag] object or FALSE on error
<a name="sample"></a>
#### Sample
{
"message":"",
"code":201,
"result":
{
"id": "mountain",
"count": 0
}
}
[Tag]: http://theopenphotoproject.org/documentation/schemas/Tag
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,91 @@
Update Tag
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the update Tag API
Use this API to update a tag.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
POST /tag/:id/update.json
<a name="parameters"></a>
### Parameters
1. count (optional), Number of photos which contain this tag
1. email (optional), An email address that corresponds to this tag
1. latitude (optional), _i.e. 34.76_ - A decimal representation of latitude.
1. longitude (optional), _i.e. -87.45_ - A decimal representation of longitude.
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
./openphoto -p -X POST -h current.openphoto.me -e /tag/sunnyvale/update.json -F 'count=10'
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->post("/tag/sunnyvale/update.json", array('count' => 10));
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _200_ on success
* _result_, A [Tag][Tag] object or FALSE on error
<a name="sample"></a>
#### Sample
{
"message":"",
"code":200,
"result":
{
"id": "mountain",
"count": 1
}
}
[Tag]: http://theopenphotoproject.org/documentation/schemas/Tag
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,86 @@
Delete Webhook
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
1. [Examples][examples]
* [Command line][example-cli]
* [PHP][example-php]
1. [Response][response]
* [Sample][sample]
----------------------------------------
<a name="purpose"></a>
### Purpose of the POST Webhook delete API
Use this API to delete an existing webhook for a user.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
POST /webhook/:id/delete.json
<a name="parameters"></a>
### Parameters
_None_
----------------------------------------
<a name="examples"></a>
### Examples
<a name="example-cli"></a>
#### Command Line (using [openphoto-php][openphoto-php])
source secrets.sh
./openphoto -p -X POST -h current.openphoto.me -e /webhook/abcdefghijklmnopqrstuvwxyz/delete.json
<a name="example-php"></a>
#### PHP (using [openphoto-php][openphoto-php])
$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->post('/webhook/abcdefghijklmnopqrstuvwxyz/delete.json');
----------------------------------------
<a name="response"></a>
### Response
The response is in a standard [response envelope](http://theopenphotoproject.org/documentation/api/Envelope).
* _message_, A string describing the result. Don't use this for anything but reading.
* _code_, _204_ on success
* _result_, A boolean
<a name="sample"></a>
#### Sample
{
"message" : "Webhook deleted successfully",
"code" : 204,
"result" : true
}
[Webhook]: http://theopenphotoproject.org/documentation/schemas/Webhook
[webhookverification]: http://theopenphotoproject.org/documentation/faq/WebhookVerification
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters
[examples]: #examples
[example-cli]: #example-cli
[example-php]: #example-php
[response]: #response
[sample]: #sample
[openphoto-php]: https://github.com/photo/openphoto-php

View file

@ -0,0 +1,49 @@
Create/Subscribe to Webhook
=======================
----------------------------------------
1. [Purpose][purpose]
1. [Endpoint][endpoint]
1. [Parameters][parameters]
----------------------------------------
<a name="purpose"></a>
### Purpose of the POST Webhook create API
Use this API to create a new webhook for a user.
This API differs from our others in that it's both interactive and does not return a [Standard Envelope](http://theopenphotoproject.org/documentation/api/Envelope). These are the steps required to complete a webhook subscription.
<a name="verification"></a>
1. The consumer _(you)_ makes a POST request to the provider _(the API host)_ to `http://apihost.com/webhook/subscribe` with the <a href="#">required parameters</a>.
1. The provider makes a GET request back to your `callback` URL passing along a `mode`, `topic`, and `challenge` parameter. A `verifyToken` parameter is passed back if originally supplied.
1. The consumer must validate that the subscription was intended (typically using the `verifyToken`) and print out the `challenge` value with a HTTP 200 response code.
1. If the consumer response is a HTTP 200 and the content body was equal to `challenge` then the provider completes the subscription.
----------------------------------------
<a name="endpoint"></a>
### Endpoint
_Authentication: required_
POST /webhook/subscribe
<a name="parameters"></a>
### Parameters
1. callback (required), A URL to POST to. This also needs to handle GET calls for the <a href="#verification">verification process</a>.
1. topic (required), _i.e. photo.upload_ - The topic which you'd like to subscribe to.
1. mode (required), Only _sync_ is supported at this time.
1. verifyToken (optional), A provider generated string to which is passed back as part of the <a href="#verification">verification process</a>.
----------------------------------------
[purpose]: #purpose
[endpoint]: #endpoint
[parameters]: #parameters

75
docs/api/Readme.markdown Normal file
View file

@ -0,0 +1,75 @@
Open Photo API
=======================
----------------------------------------
### How do I authenticate?
The Open Photo API uses [OAuth1.0a](http://oauth.net/core/1.0a/) for authentication. See the complete [guide on authentication](http://theopenphotoproject.org/documentation/api/Authentication) for details.
### What's the response format?
Every API endpoint returns a JSON response in a [standard envelope](http://theopenphotoproject.org/documentation/api/Envelope).
{
message: "A string describing the response",
code: 200,
result: {
foo: "bar"
}
}
### API Endpoints
#### Test / diagnostics endpoints
1. [GET /hello.json](http://theopenphotoproject.org/documentation/api/GetHelloWorld)
Test endpoint.
#### Action endpoings (comments, favorites, etc)
1. [POST /action/:id/:type/create.json](http://theopenphotoproject.org/documentation/api/PostActionCreate)
Create an action.
1. [POST /action/:id/delete.json](http://theopenphotoproject.org/documentation/api/PostActionDelete)
Delete an action.
#### Photo endpoints
1. [POST /photos/:id/delete.json](http://theopenphotoproject.org/documentation/api/PostPhotoDelete)
Delete a user's photo.
1. [POST /photos/:id/update.json](http://theopenphotoproject.org/documentation/api/PostPhotoUpdate)
Update data on a user's photo.
1. [GET /photo/:id/view.json](http://theopenphotoproject.org/documentation/api/GetPhoto)
Get a user's photo.
1. [GET /photos/list.json](http://theopenphotoproject.org/documentation/api/GetPhotos)
Get a list of the user's photos.
1. [GET /photo/:id/nextprevious.json](http://theopenphotoproject.org/documentation/api/GetPhotoNextPrevious)
Get the next and previous photo.
1. [POST /photo/upload.json](http://theopenphotoproject.org/documentation/api/PostPhotoUpload)
Upload a new photo.
#### Tag endpoints
1. [GET /tags/list.json](http://theopenphotoproject.org/documentation/api/GetTags)
Get a user's tags.
1. [POST /tag/create.json](http://theopenphotoproject.org/documentation/api/PostTagCreate)
Create a tag for the user.
1. [POST /tag/:id/update.json](http://theopenphotoproject.org/documentation/api/PostTagUpdate)
Modify meta data for a user's tag.
#### Group endpoints
1. [GET /group/:id/view.json](http://theopenphotoproject.org/documentation/api/GetGroup)
Get a group.
1. [GET /groups/list.json](http://theopenphotoproject.org/documentation/api/GetGroups)
Get a listing of a user's groups.
1. [POST /group/create.json](http://theopenphotoproject.org/documentation/api/PostGroupCreate)
Create a group.
1. [POST /group/delete.json](http://theopenphotoproject.org/documentation/api/PostGroupDelete)
Delete a group.
1. [POST /group/update.json](http://theopenphotoproject.org/documentation/api/PostGroupUpdate)
Update a group.
#### Webhook endpoints
1. [POST /webhook/subscribe](http://theopenphotoproject.org/documentation/api/PostWebHookSubscribe)
Update an eixsting webhook.
1. [GET /webhook/:id/view.json](http://theopenphotoproject.org/documentation/api/GetWebhook)
Get a user's webhook by id.
1. [POST /webhook/:id/delete.json](http://theopenphotoproject.org/documentation/api/PostWebHookDelete)
Delete an existing webhook.