Accounts - Huddle/huddle-apis GitHub Wiki

Summary

The Membership Accounts API is a representation of a given Account within Huddle.

Table of contents

Operation
Retrieve an Account
Remove a user from an account
Retrieving account managers

Operations

Retrieve an Account

You can GET a given Account by its ID.

Example

Example request, asking for the Account with ID 123:

GET /accounts/123 HTTP/1.1
Accept: application/vnd.huddle.data+json
Authorization: Bearer frootymcnooty/vonbootycherooty

Example response:

HTTP/1.1 200 OK
Content-Type: application/vnd.huddle.data+json
{
  "links": [
    { "rel": "self", "href": "..." },
    { "rel": "parent", "href": "..." },
    { "rel": "owner", "href": "..." },
    { "rel": "managers", "href": "..."},
    { "rel": "create-workspace", "href": "..." }
  ],
  "name": "My Account"
}

Response Properties

Name Description
name The name of the account

Response Link relations

Name Description Methods
self The URI of this account. GET
parent The URI to request the company that this account belongs to. GET
owner The URI to request the owner of the account. GET
create-workspace The URI to create a workspace in the account POST

Other Responses

Case Response
Invalid authorization token 401 Unauthorized
Actor is not an authorised user 403 Forbidden
Account does not exist 404 Not Found

Remove a user from an account

You can get the required URL from Retrieve workspace users response link for remove-from-account

Example

Example request, asking to remove a user from an account:

DELETE /accounts/123/users/456 HTTP/1.1
Authorization: Bearer frootymcnooty/vonbootycherooty

Example response:

HTTP/1.1 204 No Content

Other Responses

Case Response
Invalid authorization token 401 Unauthorized
Actor is not an authorised user 403 Forbidden
Account does not exist 404 Not Found

Retrieve Account managers

You can GET all account managers and the metadata of the managers in a account.

Example

Example request, asking for the Account managers from the Account with ID 123:

GET /accounts/123/managers HTTP/1.1
Content-Type: application/vnd.huddle.data+json
Authorization: Bearer frootymcnooty/vonbootycherooty

Example response:

HTTP/1.1 200 OK
Content-Type: application/vnd.huddle.data+json
{
  "links" : [
    { "rel" : "self", "href" : "..." },
    { "rel" : "parent", "href" : "..." },
    { "rel" : "first", "href" : "..." },
    { "rel" : "previous", "href" : "..." },
    { "rel" : "next", "href" : "..." }
  ],
  "managers" : [
    {
      "name" : "Clark Ken",
      "email" : "[email protected]",
      "links" : [
            { "rel" : "self", "href" : "..." },
            { "rel" : "avatar", "href" : "..." },
            { "rel" : "alternate", "href": "..." }
      ]
    },
    ...
  ]
}

Response Properties

Name Description
managers The list of managers for the given account

Response Link relations

Property Name Description Methods
self The URI of the account managers collection. GET
parent The URI of the account that the managers belongs to. GET
first The URI of the first page of managers. GET
previous The URI of the previous page of managers. GET
next The URI of the next page of managers. GET
managers self The URI of the user GET
managers avatar The URI of the user's avatar GET
managers alternate The URI of the user's profile GET

Other Responses

Case Response
Invalid authorization token 401 Unauthorized
Actor is not an authorised user 403 Forbidden
Account does not exist 404 Not Found

Filters

Query string parameters are used to filter the managers in a account. Returns empty list of managers if no managers were found that match your query.

Request:

GET /accounts/123/managers?q=jon&pagesize=20&skip=0&sort=email&order=asc HTTP/1.1
Accept: application/vnd.huddle.data+json
Authorization: Bearer frootymcnooty/vonbootycherooty
Parameter Default value Additional notes
q Match an account manager on firstname, lastname, email
pagesize 20
skip 0
sort email Sort account managers by email or by name
order asc Order the account managers ascending (asc) or descending (desc)

Response shape is the same as in Retrieve Account Managers