Teams

This chapter focuses on services for the teams.

Get all teams

A GET to /teams returns all the teams.

HTTP request

GET /api/rest/latest/teams?page=2&size=1 HTTP/1.1
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

page

number of the page to retrieve (optional)

size

size of the page to retrieve (optional)

sort

which attributes of the returned entities should be sorted on (optional)

fields

which fields of the elements should be returned (optional)

type

which type of the element should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 846

{
  "_embedded" : {
    "teams" : [ {
      "_type" : "team",
      "id" : 567,
      "name" : "Team A",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/teams/567"
        }
      }
    } ]
  },
  "_links" : {
    "first" : {
      "href" : "http://localhost:8080/api/rest/latest/teams?page=0&size=1"
    },
    "prev" : {
      "href" : "http://localhost:8080/api/rest/latest/teams?page=1&size=1"
    },
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/teams?page=2&size=1"
    },
    "next" : {
      "href" : "http://localhost:8080/api/rest/latest/teams?page=3&size=1"
    },
    "last" : {
      "href" : "http://localhost:8080/api/rest/latest/teams?page=4&size=1"
    }
  },
  "page" : {
    "size" : 1,
    "totalElements" : 5,
    "totalPages" : 5,
    "number" : 2
  }
}

Response fields

Path Type Description

_embedded.teams

Array

the list of elements for that page

page.size

Number

the page size for that query

page.totalElements

Number

total number of elements the user is allowed to read

page.totalPages

Number

how many pages can be browsed

page.number

Number

the page number

_links

Object

related links

Relation Description

first

link to the first page (optional)

prev

link to the previous page (optional)

self

link to this page

next

link to the next page (optional)

last

link to the last page (optional)

Create team

A POST to /teams creates a new team.

HTTP request

POST /api/rest/latest/teams HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 85
Host: localhost:8080

{
  "_type" : "team",
  "name" : "Team A",
  "description" : "<p>black panther</p>"
}

Request fields

Path Type Description

_type

String

the type of the entity

name

String

the name of the team

description

String

the description of the team

Request parameters

Parameter Description

fields

which fields of the elements should be returned (optional)

HTTP response

HTTP/1.1 201 Created
Content-Type: application/json
Content-Length: 388

{
  "_type" : "team",
  "id" : 332,
  "name" : "Team A",
  "description" : "<p>black panther</p>",
  "members" : [ ],
  "created_by" : "admin",
  "created_on" : "2017-07-04T10:00:00.000+00:00",
  "last_modified_by" : "admin",
  "last_modified_on" : "2017-07-05T10:00:00.000+00:00",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/teams/332"
    }
  }
}

Response fields

Path Type Description

id

Number

the id of the team

members

Array

the members of this team

created_by

String

the user who created this team

created_on

String

the date of this team account was created

last_modified_by

String

the user who last modified this team

last_modified_on

String

the date of this team was last modified

_links

Object

related links

Relation Description

self

link to this user

Get team

A GET to /teams/{id} returns the team with the given id.

Path parameters

Table 1. /api/rest/latest/teams/{id}
Parameter Description

id

the id of the team

HTTP request

GET /api/rest/latest/teams/567 HTTP/1.1
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

fields

which fields of the elements should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 388

{
  "_type" : "team",
  "id" : 567,
  "name" : "Team A",
  "description" : "<p>black panther</p>",
  "members" : [ ],
  "created_by" : "admin",
  "created_on" : "2017-07-04T10:00:00.000+00:00",
  "last_modified_by" : "admin",
  "last_modified_on" : "2017-07-05T10:00:00.000+00:00",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/teams/567"
    }
  }
}

Response fields

Path Type Description

_type

String

the type of the entity

id

Number

the id of the team

name

String

the name of the team

description

String

the description of the team

members

Array

the members of this team

created_by

String

the user who created this team

created_on

String

the date of this team account was created

last_modified_by

String

the user who last modified this team

last_modified_on

String

the date of this team was last modified

_links

Object

related links

Relation Description

self

link to this user

Modify team

A PATCH to /teams/{id} modifies the team with the given id.

Path parameters

Table 1. /api/rest/latest/teams/{id}
Parameter Description

id

the id of the team

HTTP request

PATCH /api/rest/latest/teams/567 HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 85
Host: localhost:8080

{
  "_type" : "team",
  "name" : "Team A",
  "description" : "<p>black panther</p>"
}

Request fields

Path Type Description

_type

String

the type of the entity

name

String

the name of the team

description

String

the description of the team

Request parameters

Parameter Description

fields

which fields of the elements should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 388

{
  "_type" : "team",
  "id" : 332,
  "name" : "Team A",
  "description" : "<p>black panther</p>",
  "members" : [ ],
  "created_by" : "admin",
  "created_on" : "2017-07-04T10:00:00.000+00:00",
  "last_modified_by" : "admin",
  "last_modified_on" : "2017-07-05T10:00:00.000+00:00",
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/teams/332"
    }
  }
}

Response fields

Path Type Description

id

Number

the id of the team

members

Array

the members of this team

created_by

String

the user who created this team

created_on

String

the date of this team account was created

last_modified_by

String

the user who last modified this team

last_modified_on

String

the date of this team was last modified

_links

Object

related links

Relation Description

self

link to this user

Delete team

A DELETE to /teams/{ids} deletes one or several team(s) with the given id(s).

Path parameters

Table 1. /api/rest/latest/teams/{ids}
Parameter Description

ids

the list of ids of the teams

HTTP request

DELETE /api/rest/latest/teams/169,189 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080

Get team members

A GET to /teams/{id}/members returns all the members of the team with the given id.

Path parameters

Table 1. /api/rest/latest/teams/{id}/members
Parameter Description

id

the id of the team

HTTP request

GET /api/rest/latest/teams/888/members HTTP/1.1
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

page

number of the page to retrieve (optional)

size

size of the page to retrieve (optional)

fields

which fields of the elements should be returned (optional)

HTTP response

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 2033

{
  "_embedded" : {
    "members" : [ {
      "_type" : "user",
      "id" : 1,
      "first_name" : "Charles",
      "last_name" : "Dupond",
      "login" : "User-1",
      "email" : "charlesdupond@aaaa.aa",
      "active" : true,
      "group" : "User",
      "last_connected_on" : "2018-02-11T11:00:00.000+00:00",
      "created_by" : "admin",
      "created_on" : "2017-07-04T10:00:00.000+00:00",
      "last_modified_by" : "admin",
      "last_modified_on" : "2017-07-05T10:00:00.000+00:00",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/users/1"
        }
      }
    }, {
      "_type" : "user",
      "id" : 2,
      "first_name" : "Chris",
      "last_name" : "Dupond",
      "login" : "User-2",
      "email" : "chrisdupond@aaaa.aa",
      "active" : true,
      "group" : "User",
      "last_connected_on" : "2018-03-11T11:00:00.000+00:00",
      "created_by" : "admin",
      "created_on" : "2017-07-04T10:00:00.000+00:00",
      "last_modified_by" : "admin",
      "last_modified_on" : "2017-07-05T10:00:00.000+00:00",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/users/2"
        }
      }
    }, {
      "_type" : "user",
      "id" : 3,
      "first_name" : "Victor",
      "last_name" : "Dupond",
      "login" : "User-3",
      "email" : "victordupond@aaaa.aa",
      "active" : true,
      "group" : "User",
      "last_connected_on" : "2018-03-11T11:00:00.000+00:00",
      "created_by" : "admin",
      "created_on" : "2017-07-04T10:00:00.000+00:00",
      "last_modified_by" : "admin",
      "last_modified_on" : "2017-07-05T10:00:00.000+00:00",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/users/3"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/teams/888/members?page=0&size=20"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 3,
    "totalPages" : 1,
    "number" : 0
  }
}

Response fields

Path Type Description

_embedded.members

Array

the members of this team

page.size

Number

the page size for that query

page.totalElements

Number

total number of elements the user is allowed to read

page.totalPages

Number

how many pages can be browsed

page.number

Number

the page number

_links

Object

related links

Relation Description

first

link to the first page (optional)

prev

link to the previous page (optional)

self

link to this page

next

link to the next page (optional)

last

link to the last page (optional)

Add members

A POST to /teams/{teamId}/members with userIds in request parameters adds these users to the team with the given id.

Path parameters

Table 1. /api/rest/latest/teams/{teamId}/members
Parameter Description

teamId

the id of the team

HTTP request

POST /api/rest/latest/teams/888/members?userIds=486,521 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

userIds

the ids of the members to add

Remove members

A DELETE to /teams/{teamId}/members with userIds in request parameters removes these users from the team with the given id.

Path parameters

Table 1. /api/rest/latest/teams/{teamId}/members
Parameter Description

teamId

the id of the team

HTTP request

DELETE /api/rest/latest/teams/888/members?userIds=486,521 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080

Request parameters

Parameter Description

userIds

the ids of the members to remove