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

2.8 KiB

Create Action


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

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

  1. email (required), Email address of the user performing this action
  2. name (optional), Name of the user performing this action
  3. website (optional), URL of the user performing this action
  4. targetUrl (optional), URL of the object this action is being performed on
  5. permalink (optional), Permalink URL of this action
  6. type (required), i.e. comment or favorite - Type of action
  7. 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, An 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
  }
}