2.8 KiB
2.8 KiB
Create Action
Purpose of the create action API
Use this API to create an action on a photo. This includes comments and favorites.
Endpoint
Authentication: required
POST /action/:targetId/photo/create.json
Parameters
- email (required), Email address of the user performing this action
- name (optional), Name of the user performing this action
- website (optional), URL of the user performing this action
- targetUrl (optional), URL of the object this action is being performed on
- permalink (optional), Permalink URL of this action
- type (required), i.e. comment or favorite - Type of action
- value (required), Text representing the comment or favorite
Examples
Command Line (using 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'
PHP (using 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'));
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, A Action object or FALSE on error
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
}
}