Accounts - Huddle/huddle-apis GitHub Wiki
Summary
The Membership Accounts API is a representation of a given Account within Huddle.
Operations
| Method | Path | Purpose | Details |
|---|---|---|---|
GET |
/membership/accounts/123 |
Retrieve an Account | Jump |
DELETE |
/membership/accounts/123/users/456 |
Remove a user from an account | Jump |
GET |
/membership/accounts/123/managers |
Retrieving account managers | Jump |
Retrieve an Account
You can GET a given Account by its ID.
Example
Example request, asking for the Account with ID 123:
GET /membership/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": "..." }
],
"name": "My Account"
}
When the authenticated actor is allowed to create workspaces in the account, a create-workspace link is also present (same links array).
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 |
| managers | The URI of the account managers collection for this account. | GET |
| create-workspace | Present only when the actor may create workspaces. 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 /membership/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 /membership/accounts/123/managers 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" : "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": "..." }
]
},
...
]
}
Which of first, previous, and next appear depends on the current page and whether more results exist (e.g. on the first page, first and previous are omitted).
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 /membership/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 |
Omitted or 0 is treated as the default page size. |
skip |
0 |
|
sort |
email |
Use email (case-insensitive) to sort by email; any other value sorts by display name. |
order |
asc |
Order the account managers ascending (asc) or descending (desc) |
Response shape is the same as in Retrieve Account Managers