Teams
This chapter focuses on additional services for the teams. These services extend driven-by-id methods implemented in the Rest Services API by allowing search by Team name.
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 |
---|---|
|
number of the page to retrieve (optional) |
|
size of the page to retrieve (optional) |
|
which attributes of the returned entities should be sorted on (optional) |
|
which fields of the elements should be returned (optional) |
|
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 |
---|---|---|
|
|
the list of elements for that page |
|
|
the page size for that query |
|
|
total number of elements |
|
|
how many pages can be browsed |
|
|
the page number |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to the first page (optional) |
|
link to the previous page (optional) |
|
link to this page |
|
link to the next page (optional) |
|
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 |
---|---|---|
|
|
the type of the entity |
|
|
the name of the team |
|
|
the description of the team |
Request parameters
Parameter | Description |
---|---|
|
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 |
---|---|---|
|
|
the id of the team |
|
|
the members of this team |
|
|
the user who created this team |
|
|
the date of this team account was created |
|
|
the user who last modified this team |
|
|
the date of this team was last modified |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this user |
Get team
A GET
to /teams/{id}
returns the team with the given id.
Path parameters
Parameter | Description |
---|---|
|
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 |
---|---|
|
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 |
---|---|---|
|
|
the type of the entity |
|
|
the id of the team |
|
|
the name of the team |
|
|
the description of the team |
|
|
the members of this team |
|
|
the user who created this team |
|
|
the date of this team account was created |
|
|
the user who last modified this team |
|
|
the date of this team was last modified |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this user |
Modify team
A PATCH
to /teams/{id}
modifies the team with the given id.
Path parameters
Parameter | Description |
---|---|
|
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 |
---|---|---|
|
|
the type of the entity |
|
|
the name of the team |
|
|
the description of the team |
Request parameters
Parameter | Description |
---|---|
|
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 |
---|---|---|
|
|
the id of the team |
|
|
the members of this team |
|
|
the user who created this team |
|
|
the date of this team account was created |
|
|
the user who last modified this team |
|
|
the date of this team was last modified |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to this user |
Delete team
A DELETE
to /teams/{ids}
deletes one or several team(s) with the given id(s).
Path parameters
Parameter | Description |
---|---|
|
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/team-name/{teamName}/members
returns all the members of the team with the given teamName.
Path parameters
Parameter | Description |
---|---|
|
the name of the team |
HTTP request
GET /api/rest/latest/teams/team-name/Team%20A/members HTTP/1.1
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
number of the page to retrieve (optional) |
|
size of the page to retrieve (optional) |
|
which fields of the elements should be returned (optional) |
HTTP response
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 2225
{
"_embedded" : {
"members" : [ {
"_type" : "user",
"id" : 1,
"first_name" : "Charles",
"last_name" : "Dupond",
"login" : "User-1",
"email" : "charlesdupond@aaaa.aa",
"active" : true,
"group" : "User",
"can_delete_from_front" : true,
"teams" : [ ],
"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",
"can_delete_from_front" : true,
"teams" : [ ],
"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",
"can_delete_from_front" : true,
"teams" : [ ],
"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/team-name/Team%20A/members?page=0&size=20"
}
},
"page" : {
"size" : 20,
"totalElements" : 3,
"totalPages" : 1,
"number" : 0
}
}
Response fields
Path | Type | Description |
---|---|---|
|
|
the members of this team |
|
|
the page size for that query |
|
|
total number of elements |
|
|
how many pages can be browsed |
|
|
the page number |
|
|
related links |
Links
Relation | Description |
---|---|
|
link to the first page (optional) |
|
link to the previous page (optional) |
|
link to this page |
|
link to the next page (optional) |
|
link to the last page (optional) |
Add members
A POST
to /teams/team-name/{teamName}/members
with userLogins in request parameters adds these users to the team with the given teamName.
Path parameters
Parameter | Description |
---|---|
|
the name of the team |
HTTP request
POST /api/rest/latest/teams/team-name/Team%20A/members HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
userLogins=John+Doe%2C+Jane+Doe
Request parameters
Parameter | Description |
---|---|
|
the logins of the members to add |
Remove members
A DELETE
to /teams/team-name/{teamName}/members
with userLogins in request parameters removes these users from the team with the given teamName.
Path parameters
Parameter | Description |
---|---|
|
the name of the team |
HTTP request
DELETE /api/rest/latest/teams/team-name/Team%20A/members?userLogins=John+Doe%2C+Jane+Doe HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Request parameters
Parameter | Description |
---|---|
|
the logins of the members to remove |