photo-documentation/docs/api/GetActivities.markdown
2013-01-28 22:49:14 -05:00

4.4 KiB

Get Activities


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

Purpose of the Get Activities API

Use this API to get a user's activity feed.


Endpoint

Authentication: optional

GET /activities/list.json

Parameters

  1. groupBy (optional), Time period to group activities by

Examples

Command Line (using openphoto-php)

./openphoto -p -h current.openphoto.me -e /activities/list.json

PHP (using openphoto-php)

$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->get("/tags/activities.json");

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 array of activities

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"
      }
    ]
  }
}