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

2.6 KiB

Get Groups


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

Purpose of the Get Groups API

Use this API to get a list of the user's groups.


Endpoint

Authentication: required

GET /groups/list.json

Parameters

None


Examples

Command Line (using openphoto-php)

source secrets.sh
./openphoto -p -h current.openphoto.me -e /groups/list.json

PHP (using openphoto-php)

$client = new OpenPhotoOAuth($host, $consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
$response = $client->get("/groups/list.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 Group objects

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