Mozillians/API-Specification/Methods

From MozillaWiki
Jump to: navigation, search

Mozillians API Methods

Authentication

This method requires authentication. Authentication requires a registered and activated App, thus an AppName and AppKey.

List Users

Arguments

  • app_name (Required): Your registered app name. This is case sensitive.
  • app_key (Required): Your app key.
  • is_vouched [True,False] (Optional) (Only available to Mozilla Apps): Return users that are vouched or not.
  • email [alphanumeric] (Required for Community Apps / Optional to Mozilla Apps): Return user with matching email.
  • country [alphanumeric] (Optional) (Only available to Mozilla Apps): Return users with matching country. Case insensitive.
  • region [alphanumeric] (Optional) (Only available to Mozilla Apps): Return users with matching region. Case insensitive.
  • city [alphanumeric] (Optional) (Only available to Mozilla Apps): Return users with matching city. Case insensitive.
  • skills [alphanumeric] (Optional) (Only available to Mozilla Apps): Return users with matching skills. Case insensitive. Skills can be comma separated to filter users with any of the listed skills.
  • languages [alphanumeric] (Optional) (Only available to Mozilla Apps): Return users with matching languages. Case insensitive. Languages can be comma separated to filter users with any of the listed languages.
  • groups [alphanumeric] (Optional) (Only available to Mozilla Apps): Return users with matching groups. Case insensitive. Groups can be comma separated to filter users with any of the listed groups.
  • limit [number] (Optional): Limit answer to [number] results.
  • offset [number] (Optional): Skip [number] results. Defaults to 0.
  • format [json,xml] (Optional): Reply in this format. Defaults to 'json'.

Arguments country, region, city, is_vouched, email, skills, languages, groups can be combined. The returned results will be logically ANDed.

Return Codes

  • 200: OK : All OK ;)
  • 401: Unauthorized: Wrong AppName or AppKey or App not activated


Examples

Community Apps
  • /api/v1/?appname=foobar&appkey=12345&email=test@example.com
   {
      "meta":
      {
          "limit": 20,
          "next": null,
          "offset": 0,
          "previous": null,
          "total_count": 1
      },
      "objects":
      [
          {
              "email": "test@example.com",
              "is_vouched": true
          }
      ]
   }
  • /api/v1/?appname=foobar&appkey=12345&email=test@example.com&format=xml
   <?xml version='1.0' encoding='utf-8'?>
   <response>
   <objects type="list">
   <object>
   <email>giorgos@mozilla.com</email>
   <is_vouched type="boolean">True</is_vouched>
   </object>
   </objects>
   <meta type="hash">
   <next type="null"/>
   <total_count type="integer">1</total_count>
   <previous type="null"/>
   <limit type="integer">20</limit>
   <offset type="integer">0</offset>
   </meta>
   </response>
  • /api/v1/?appname=foobar&appkey=12345
 FORBIDDEN
  • /api/v1/1/?appname=foobar&appkey=12345
 FORBIDDEN
Mozilla Apps
  • /api/v1/?appname=foobar&appkey=12345
   {
      "meta":
      {
          "limit": 20,
          "next": null,
          "offset": 0,
          "previous": null,
          "total_count": 4
      },
      "objects":
      [
          {
              "bio": "",
              "city": "",
              "country": "",
              "display_name": "Example Test",
              "email": "test@example.com",
              "groups":
              [
                  "staff"
              ],
              "id": "1",
              "ircname": "",
              "is_vouched": true,
              "languages":
              [
              ],
              "last_updated": "2012-10-04T02:31:30",
              "photo": "",
              "region": "",
              "resource_uri": "/api/v1/user/1/",
              "skills":
              [
                  "python"
              ],
              "website": ""
          }
      ]
   }
  • /api/v1/1/?appname=foobar&appkey=12345
   {
      "bio": "",
      "city": "",
      "country": "",
      "display_name": "Example Test",
      "email": "test@example.com",
      "groups":
      [
          "staff"
      ],
      "id": "1",
      "ircname": "",
      "is_vouched": true,
      "languages":
      [
      ],
      "last_updated": "2012-10-04T02:31:30",
      "photo": "",
      "region": "",
      "resource_uri": "/api/v1/user/1/",
      "skills":
      [
          "python"
      ],
      "website": ""
   }