Team API

This API can be used to manage Teams and Team Memberships.

Access to these API endpoints is restricted as follows:

  • All authenticated users are able to view details of teams they are a member of.
  • Organization Admins are able to manage all teams and team members.
  • If the editors_can_admin configuration flag is enabled, Organization Editors are able to view details of all teams and to manage teams that they are Admin members of.

Team Search With Paging

GET /api/teams/search?perpage=50&page=1&query=myteam

or

GET /api/teams/search?name=myteam

  1. GET /api/teams/search?perpage=10&page=1&query=myteam HTTP/1.1
  2. Accept: application/json
  3. Content-Type: application/json
  4. Authorization: Basic YWRtaW46YWRtaW4=

Using the query parameter

Default value for the perpage parameter is 1000 and for the page parameter is 1.

The totalCount field in the response can be used for pagination of the teams list E.g. if totalCount is equal to 100 teams and the perpage parameter is set to 10 then there are 10 pages of teams.

The query parameter is optional and it will return results where the query value is contained in the name field. Query values with spaces need to be URL encoded e.g. query=my%20team.

Using the name parameter

The name parameter returns a single team if the parameter matches the name field.

Example Response:

  1. HTTP/1.1 200
  2. Content-Type: application/json
  3. {
  4. "totalCount": 1,
  5. "teams": [
  6. {
  7. "id": 1,
  8. "orgId": 1,
  9. "name": "MyTestTeam",
  10. "email": "",
  11. "avatarUrl": "\/avatar\/3f49c15916554246daa714b9bd0ee398",
  12. "memberCount": 1
  13. }
  14. ],
  15. "page": 1,
  16. "perPage": 1000
  17. }

Status Codes:

  • 200 - Ok
  • 401 - Unauthorized
  • 403 - Permission denied
  • 404 - Team not found (if searching by name)

Get Team By Id

GET /api/teams/:id

Example Request:

  1. GET /api/teams/1 HTTP/1.1
  2. Accept: application/json
  3. Content-Type: application/json
  4. Authorization: Basic YWRtaW46YWRtaW4=

Example Response:

  1. HTTP/1.1 200
  2. Content-Type: application/json
  3. {
  4. "id": 1,
  5. "orgId": 1,
  6. "name": "MyTestTeam",
  7. "email": "",
  8. "created": "2017-12-15T10:40:45+01:00",
  9. "updated": "2017-12-15T10:40:45+01:00"
  10. }

Status Codes:

  • 200 - Ok
  • 401 - Unauthorized
  • 403 - Permission denied
  • 404 - Team not found

Add Team

The Team name needs to be unique. name is required and email,orgId is optional.

POST /api/teams

Example Request:

  1. POST /api/teams HTTP/1.1
  2. Accept: application/json
  3. Content-Type: application/json
  4. Authorization: Basic YWRtaW46YWRtaW4=
  5. {
  6. "name": "MyTestTeam",
  7. "email": "email@test.com",
  8. "orgId": 2
  9. }

Example Response:

  1. HTTP/1.1 200
  2. Content-Type: application/json
  3. {"message":"Team created","teamId":2}

Status Codes:

  • 200 - Ok
  • 401 - Unauthorized
  • 403 - Permission denied
  • 409 - Team name is taken

Update Team

There are two fields that can be updated for a team: name and email.

PUT /api/teams/:id

Example Request:

  1. PUT /api/teams/2 HTTP/1.1
  2. Accept: application/json
  3. Content-Type: application/json
  4. Authorization: Basic YWRtaW46YWRtaW4=
  5. {
  6. "name": "MyTestTeam",
  7. "email": "email@test.com"
  8. }

Example Response:

  1. HTTP/1.1 200
  2. Content-Type: application/json
  3. {"message":"Team updated"}

Status Codes:

  • 200 - Ok
  • 401 - Unauthorized
  • 403 - Permission denied
  • 404 - Team not found
  • 409 - Team name is taken

Delete Team By Id

DELETE /api/teams/:id

Example Request:

  1. DELETE /api/teams/2 HTTP/1.1
  2. Accept: application/json
  3. Content-Type: application/json
  4. Authorization: Basic YWRtaW46YWRtaW4=

Example Response:

  1. HTTP/1.1 200
  2. Content-Type: application/json
  3. {"message":"Team deleted"}

Status Codes:

  • 200 - Ok
  • 401 - Unauthorized
  • 403 - Permission denied
  • 404 - Failed to delete Team. ID not found

Get Team Members

GET /api/teams/:teamId/members

Example Request:

  1. GET /api/teams/1/members HTTP/1.1
  2. Accept: application/json
  3. Content-Type: application/json
  4. Authorization: Basic YWRtaW46YWRtaW4=

Example Response:

  1. HTTP/1.1 200
  2. Content-Type: application/json
  3. [
  4. {
  5. "orgId": 1,
  6. "teamId": 1,
  7. "userId": 3,
  8. "email": "user1@email.com",
  9. "login": "user1",
  10. "avatarUrl": "\/avatar\/1b3c32f6386b0185c40d359cdc733a79"
  11. },
  12. {
  13. "orgId": 1,
  14. "teamId": 1,
  15. "userId": 2,
  16. "email": "user2@email.com",
  17. "login": "user2",
  18. "avatarUrl": "\/avatar\/cad3c68da76e45d10269e8ef02f8e73e"
  19. }
  20. ]

Status Codes:

  • 200 - Ok
  • 401 - Unauthorized
  • 403 - Permission denied

Add Team Member

POST /api/teams/:teamId/members

Example Request:

  1. POST /api/teams/1/members HTTP/1.1
  2. Accept: application/json
  3. Content-Type: application/json
  4. Authorization: Basic YWRtaW46YWRtaW4=
  5. {
  6. "userId": 2
  7. }

Example Response:

  1. HTTP/1.1 200
  2. Content-Type: application/json
  3. {"message":"Member added to Team"}

Status Codes:

  • 200 - Ok
  • 400 - User is already added to this team
  • 401 - Unauthorized
  • 403 - Permission denied
  • 404 - Team not found

Remove Member From Team

DELETE /api/teams/:teamId/members/:userId

Example Request:

  1. DELETE /api/teams/2/members/3 HTTP/1.1
  2. Accept: application/json
  3. Content-Type: application/json
  4. Authorization: Basic YWRtaW46YWRtaW4=

Example Response:

  1. HTTP/1.1 200
  2. Content-Type: application/json
  3. {"message":"Team Member removed"}

Status Codes:

  • 200 - Ok
  • 401 - Unauthorized
  • 403 - Permission denied
  • 404 - Team not found/Team member not found

Get Team Preferences

GET /api/teams/:teamId/preferences

Example Request:

  1. GET /api/teams/2/preferences HTTP/1.1
  2. Accept: application/json
  3. Content-Type: application/json
  4. Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk

Example Response:

  1. HTTP/1.1 200
  2. Content-Type: application/json
  3. {
  4. "theme": "",
  5. "homeDashboardId": 0,
  6. "timezone": ""
  7. }

Update Team Preferences

PUT /api/teams/:teamId/preferences

Example Request:

  1. PUT /api/teams/2/preferences HTTP/1.1
  2. Accept: application/json
  3. Content-Type: application/json
  4. Authorization: Bearer eyJrIjoiT0tTcG1pUlY2RnVKZTFVaDFsNFZXdE9ZWmNrMkZYbk
  5. {
  6. "theme": "dark",
  7. "homeDashboardId": 39,
  8. "timezone": "utc"
  9. }

JSON Body Schema:

  • theme - One of: light, dark, or an empty string for the default theme
  • homeDashboardId - The numerical :id of a dashboard, default: 0
  • timezone - One of: utc, browser, or an empty string for the default

Omitting a key will cause the current value to be replaced with the system default value.

Example Response:

  1. HTTP/1.1 200
  2. Content-Type: text/plain; charset=utf-8
  3. {
  4. "message":"Preferences updated"
  5. }