Users

This chapter focuses on additional services for the users. These services extend driven-by-id methods implemented in the Rest Services API by allowing search by User login.

get Get all users

A GET to /users returns all the users.

HTTP request

GET /api/rest/latest/users?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: 894

{
  "_embedded" : {
    "users" : [ {
      "_type" : "user",
      "id" : 486,
      "login" : "User-1",
      "active" : true,
      "group" : "User",
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/users/486"
        }
      }
    } ]
  },
  "_links" : {
    "first" : {
      "href" : "http://localhost:8080/api/rest/latest/users?page=0&size=1"
    },
    "prev" : {
      "href" : "http://localhost:8080/api/rest/latest/users?page=1&size=1"
    },
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/users?page=2&size=1"
    },
    "next" : {
      "href" : "http://localhost:8080/api/rest/latest/users?page=3&size=1"
    },
    "last" : {
      "href" : "http://localhost:8080/api/rest/latest/users?page=4&size=1"
    }
  },
  "page" : {
    "size" : 1,
    "totalElements" : 5,
    "totalPages" : 5,
    "number" : 2
  }
}

Response fields

Path Type Description

_embedded.users

Array

the list of elements for that page

page.size

Number

the page size for that query

page.totalElements

Number

total number of elements

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)

get Get user

A GET to /users/login/{login} returns the user with the given login.

Path parameters

Table 1. /api/rest/latest/users/login/{login}
Parameter Description

login

the login of the user

HTTP request

GET /api/rest/latest/users/login/User-1 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: 566

{
  "_type" : "user",
  "id" : 486,
  "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/486"
    }
  }
}

Response fields

Path Type Description

id

Number

the id of the user

_type

String

the type of the entity

first_name

String

the first name of the user

last_name

String

the last name of the user

login

String

the login of the user

email

String

the email address of the user

active

Boolean

whether the user is activate or not

group

String

the group of the user belong (admin or user)

can_delete_from_front

Boolean

whether the user can delete library entities from the front-end with the Squash TM Premium plugin

teams

Array

the team of the user participate

last_connected_on

String

the date of this user was last connected

created_by

String

the user who created this user account

created_on

String

the date of this user account was created

last_modified_by

String

the user who last modified this user account

last_modified_on

String

the date of this user account was last modified

_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)

post Create user

A POST to /users creates a new user.

HTTP request

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

{
  "_type" : "user",
  "first_name" : "Charles",
  "last_name" : "Dupond",
  "login" : "User-1",
  "password" : "123456",
  "email" : "charlesdupond@aaaa@aa",
  "group" : "User",
  "can_delete_from_front" : true
}

Request fields

Path Type Description

_type

String

the type of the entity

first_name

String

the first name of the user

last_name

String

the last name of the user

login

String

the login of the user

password

String

the password of the user

email

String

the email address of the user

group

String

the group of the user belong (admin, user or testAutomationServer)

can_delete_from_front

Boolean

whether the user can delete library entities from the front-end with the Squash TM Premium plugin

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: 566

{
  "_type" : "user",
  "id" : 987,
  "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-03-05T11: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/987"
    }
  }
}

Response fields

Path Type Description

id

Number

the id of the user

active

Boolean

whether the user is activate or not

teams

Array

the team of the user participate

last_connected_on

String

the date of this user was last connected

created_by

String

the user who created this user account

created_on

String

the date of this user account was created

last_modified_by

String

the user who last modified this user account

last_modified_on

String

the date of this user account was last modified

_links

Object

related links

Relation Description

self

link to this user

patch Modify user

A PATCH to /users/{id} modifies the user with the given id.

Warning
Once a user has been created with the Test Automation Server group, it is no longer possible to modify this group. Similarly, it is not possible to modify a user in the User or Administrator group for the Test Automation Server group.

Path parameters

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

id

the id of the user

HTTP request

PATCH /api/rest/latest/users/987 HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 236
Host: localhost:8080

{
  "_type" : "user",
  "first_name" : "Charles",
  "last_name" : "Dupond",
  "login" : "User-42",
  "password" : "123456",
  "email" : "charlesdupond@bbbb@bb",
  "active" : false,
  "group" : "User",
  "can_delete_from_front" : false
}

Request fields

Path Type Description

_type

String

the type of the entity

first_name

String

the first name of the user

last_name

String

the last name of the user

login

String

the login of the user

password

String

the password of the user

email

String

the email address of the user

active

Boolean

whether the user is activate or not

group

String

the group of the user belong (admin, user or testAutomationServer)

can_delete_from_front

Boolean

whether the user can delete library entities from the front-end with the Squash TM Premium plugin

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: 569

{
  "_type" : "user",
  "id" : 987,
  "first_name" : "Charles",
  "last_name" : "Dupond",
  "login" : "User-42",
  "email" : "charlesdupond@bbbb.bb",
  "active" : false,
  "group" : "User",
  "can_delete_from_front" : false,
  "teams" : [ ],
  "last_connected_on" : "2018-03-05T11: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/987"
    }
  }
}

Response fields

Path Type Description

id

Number

the id of the user

teams

Array

the team of which the user is a member

last_connected_on

String

the date of this user was last connected

created_by

String

the user who created this user account

created_on

String

the date of this user account was created

last_modified_by

String

the user who last modified this user account

last_modified_on

String

the date of this user account was last modified

can_delete_from_front

Boolean

whether the user can delete library entities from the front-end with the Squash TM Premium plugin

_links

Object

related links

Relation Description

self

link to this user

delete Delete user

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

Path parameters

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

ids

the list of ids of the users

HTTP request

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

get Get user subscribed teams

A GET to return all the subscribed teams of the user, either by id or by login.

Get user subscribed teams by id

A GET to /users/{userId}/teams returns all the subscribed teams of the user with the given id.

Path parameters
Table 1. /api/rest/latest/users/{userId}/teams
Parameter Description

userId

the id of the user

HTTP request
GET /api/rest/latest/users/486/teams 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: 1120

{
  "_embedded" : {
    "teams" : [ {
      "_type" : "team",
      "id" : 567,
      "name" : "Team A",
      "description" : "<p>black panther</p>",
      "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"
        }
      }
    }, {
      "_type" : "team",
      "id" : 568,
      "name" : "Team B",
      "description" : "<p>black widow</p>",
      "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/568"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/users/486/teams?page=0&size=20"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 2,
    "totalPages" : 1,
    "number" : 0
  }
}
Response fields
Path Type Description

_embedded.teams

Array

the teams of this user

page.size

Number

the page size for that query

page.totalElements

Number

total number of elements

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)

Get user subscribed teams by login

A GET to /users/login/{login}/teams returns all the subscribed teams of the user with the given login.

Path parameters
Table 1. /api/rest/latest/users/login/{login}/teams
Parameter Description

login

the login of the user

HTTP request
GET /api/rest/latest/users/login/User-1/teams 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: 1129

{
  "_embedded" : {
    "teams" : [ {
      "_type" : "team",
      "id" : 567,
      "name" : "Team A",
      "description" : "<p>black panther</p>",
      "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"
        }
      }
    }, {
      "_type" : "team",
      "id" : 568,
      "name" : "Team B",
      "description" : "<p>black widow</p>",
      "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/568"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/users/login/User-1/teams?page=0&size=20"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 2,
    "totalPages" : 1,
    "number" : 0
  }
}
Response fields
Path Type Description

_embedded.teams

Array

the teams of this user

page.size

Number

the page size for that query

page.totalElements

Number

total number of elements

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)

post Subscribe to teams

A POST to subscribe the user to their teams, either by ids or by names.

Subscribe to teams by ids

A POST to /users/{userId}/teams with teamIds in request parameters subscribes the user with the given id to these teams.

Path parameters
Table 1. /api/rest/latest/users/{userId}/teams
Parameter Description

userId

the id of the user

HTTP request
POST /api/rest/latest/users/987/teams?teamIds=486,487 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Request parameters
Parameter Description

teamIds

the list of ids of the teams

Subscribe to teams by names

A POST to /users/login/{login}/teams with teamNames in request parameters subscribes the user with the given login to these teams.

Path parameters
Table 1. /api/rest/latest/users/login/{login}/teams
Parameter Description

login

the login of the user

HTTP request
POST /api/rest/latest/users/login/User-1/teams HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080

teamNames=team-1%2C+team-2
Request parameters
Parameter Description

teamNames

the list of names of the teams

delete Unsubscribe from teams

A DELETE to unsubscribe the user from their teams, either by ids or by names.

Unsubscribe from teams by ids

A DELETE to /users/{userId}/teams with teamIds in request parameters unsubscribes the user with the given id from these teams.

Path parameters
Table 1. /api/rest/latest/users/{userId}/teams
Parameter Description

userId

the id of the user

HTTP request
DELETE /api/rest/latest/users/987/teams?teamIds=486,487 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Request parameters
Parameter Description

teamIds

the list of ids of the teams

Unsubscribe from teams by names

A DELETE to /users/login/{login}/teams with teamNames in request parameters unsubscribes the user with the given login from these teams.

Path parameters
Table 1. /api/rest/latest/users/login/{login}/teams
Parameter Description

login

the login of the user

HTTP request
DELETE /api/rest/latest/users/login/User-1/teams?teamNames=team-1%2C+team-2 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080
Request parameters
Parameter Description

teamNames

the list of names of the teams

get Get user clearances

A GET to /users/{id}/clearances returns the clearances grouped by profiles for the user with the given id.

Path parameters

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

id

the id of the user

HTTP request

GET /api/rest/latest/users/486/clearances HTTP/1.1
Accept: application/json
Host: localhost:8080

HTTP response

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

{
  "content" : {
    "test_designer" : {
      "_type" : "profile",
      "id" : 7,
      "name" : "TestDesigner",
      "type" : "system",
      "projects" : [ {
        "_type" : "project",
        "id" : 367,
        "description" : "<p>This project is the main sample project</p>",
        "label" : "Main Sample Project",
        "name" : "proj1",
        "active" : true,
        "attachments" : [ ],
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/projects/367"
          }
        }
      }, {
        "_type" : "project",
        "id" : 368,
        "description" : "<p>This project is the main sample project</p>",
        "label" : "Main Sample Project",
        "name" : "proj2",
        "active" : true,
        "attachments" : [ ],
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/projects/368"
          }
        }
      } ]
    },
    "validator" : {
      "_type" : "profile",
      "id" : 9,
      "name" : "Validator",
      "type" : "system",
      "projects" : [ {
        "_type" : "project",
        "id" : 369,
        "description" : "<p>This project is the main sample project</p>",
        "label" : "Main Sample Project",
        "name" : "proj3",
        "active" : true,
        "attachments" : [ ],
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/projects/369"
          }
        }
      } ]
    }
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/users/486/clearances"
    }
  }
}

Response fields

Path Type Description

content

Object

contains clearances grouped by profiles

content.validator

Object

contains the profile attributes (example of the validator profile)

content.validator._type

String

the type of the entity

content.validator.id

Number

the id of the profile

content.validator.name

String

the name of the profile

content.validator.type

String

system if the profile is a system profile, custom if the profile is a custom profile

content.validator.projects

Array

the list of projects linked to the profile

_links

Object

related links

Relation Description

self

the link to this user clearances

Get user clearances (deprecated)

A GET to /users/{id}/permissions returns the clearances grouped by profiles for the user with the given id.

This endpoint is still functional but is deprecated. Please use the more comprehensive /users/{id}/clearances endpoint instead.

Path parameters
Table 1. /api/rest/latest/users/{id}/permissions
Parameter Description

id

the id of the user

HTTP request
GET /api/rest/latest/users/486/permissions 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: 1289

{
  "content" : {
    "test_designer" : [ {
      "_type" : "project",
      "id" : 367,
      "description" : "<p>This project is the main sample project</p>",
      "label" : "Main Sample Project",
      "name" : "proj1",
      "active" : true,
      "attachments" : [ ],
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/projects/367"
        }
      }
    }, {
      "_type" : "project",
      "id" : 368,
      "description" : "<p>This project is the main sample project</p>",
      "label" : "Main Sample Project",
      "name" : "proj2",
      "active" : true,
      "attachments" : [ ],
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/projects/368"
        }
      }
    } ],
    "validator" : [ {
      "_type" : "project",
      "id" : 369,
      "description" : "<p>This project is the main sample project</p>",
      "label" : "Main Sample Project",
      "name" : "proj3",
      "active" : true,
      "attachments" : [ ],
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/projects/369"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/users/486/permissions"
    }
  }
}
Relation Description

self

the link to this user clearances

post Add clearances to user

A POST to /users/{userId}/clearances/{profileId}/projects/{projectIds} adds given project ids to the given profile id of the user with the given id.

Path parameters

Table 1. /api/rest/latest/users/{userId}/clearances/{profileId}/projects/{projectIds}
Parameter Description

userId

the id of the user

profileId

the id of the profile

projectIds

the ids of the projects

HTTP request

POST /api/rest/latest/users/486/clearances/9/projects/369 HTTP/1.1
Accept: application/json
Host: localhost:8080

HTTP response

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

{
  "content" : {
    "test_designer" : {
      "_type" : "profile",
      "id" : 4,
      "name" : "TestDesigner",
      "type" : "system",
      "projects" : [ {
        "_type" : "project",
        "id" : 369,
        "description" : "<p>This project is the main sample project</p>",
        "label" : "Main Sample Project",
        "name" : "proj3",
        "active" : true,
        "attachments" : [ ],
        "_links" : {
          "self" : {
            "href" : "http://localhost:8080/api/rest/latest/projects/369"
          }
        }
      } ]
    }
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/users/486/clearances"
    }
  }
}

Response fields

Path Type Description

content

Object

contains the added clearance

content.test_designer

Object

contains the profile attributes (example of the test designer profile)

content.test_designer._type

String

the type of the entity

content.test_designer.id

Number

the id of the profile

content.test_designer.name

String

the name of the profile

content.test_designer.type

String

system if the profile is a system profile, custom if the profile is a custom profile

content.test_designer.projects

Array

the list of projects linked to the profile

_links

Object

related links

Relation Description

self

the link to this user clearances

Add clearances to user (deprecated - only for system profile)

A POST to /users/{userId}/permissions/{permissionGroup} adds system profile to the user with the given id.

The possible {permissionGroup} are test_editor, project_viewer, project_manager, test_runner, test_designer, advanced_tester and validator.

This endpoint is still functional but is deprecated. Please use the more comprehensive /users/{userId}/clearances/{profileId}/projects/{projectIds} endpoint instead.

Path parameters
Table 1. /api/rest/latest/users/{userId}/permissions/{permissionGroup}
Parameter Description

userId

the id of the user

permissionGroup

the profile

HTTP request
POST /api/rest/latest/users/486/permissions/test_designer?ids=369 HTTP/1.1
Accept: application/json
Host: localhost:8080
Request parameters
Parameter Description

ids

the ids of the projects

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

{
  "content" : {
    "test_designer" : [ {
      "_type" : "project",
      "id" : 369,
      "description" : "<p>This project is the main sample project</p>",
      "label" : "Main Sample Project",
      "name" : "proj3",
      "active" : true,
      "attachments" : [ ],
      "_links" : {
        "self" : {
          "href" : "http://localhost:8080/api/rest/latest/projects/369"
        }
      }
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/users/486/permissions"
    }
  }
}
Relation Description

self

the link to this user clearances

delete Delete clearances for user

A DELETE to /users/{userId}/clearances/{projectIds} deletes one or several clearances for the given user and given project ids (separated with comma).

Path parameters

Table 1. /api/rest/latest/users/{userId}/clearances/{projectIds}
Parameter Description

userId

the id of the user

projectIds

the ids of the project to remove

HTTP request

DELETE /api/rest/latest/users/486/clearances/369,370 HTTP/1.1
Accept: application/json
Host: localhost:8080

Delete clearances for user (deprecated)

A DELETE to /users/{id}/permissions deletes one or several clearances for the given user (ids of projects separated with comma).

This endpoint is still functional but is deprecated. Please use the more comprehensive /users/{userId}/clearances/{projectIds} endpoint instead.

Path parameters
Table 1. /api/rest/latest/users/{id}/permissions
Parameter Description

id

the id of the user

HTTP request
DELETE /api/rest/latest/users/486/permissions?ids=369 HTTP/1.1
Accept: application/json
Host: localhost:8080
Request parameters
Parameter Description

ids

the ids of the projects

get Get API tokens for a Test automation server user

A GET to /users/{id}/tokens returns the API token list for the given Test automation server user id.

Path parameters

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

id

the id of the Test automation server user

HTTP request

GET /api/rest/latest/users/4/tokens HTTP/1.1
Accept: application/json
Host: localhost:8080

HTTP response

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

{
  "_embedded" : {
    "api-tokens" : [ {
      "id" : 1,
      "uuid" : "f8e2f2d8-0fbf-4d29-8003-b729bfe212c8",
      "user" : {
        "_type" : "user",
        "id" : 4
      },
      "name" : "token 1",
      "createdOn" : "2024-06-15T07:48:02.000+00:00",
      "createdBy" : "admin",
      "expiryDate" : "2025-02-03",
      "lastUsage" : "2024-06-28T09:54:27.000+00:00",
      "permissions" : "READ"
    }, {
      "id" : 2,
      "uuid" : "9e02ea67-f7ae-4c22-80c5-cb6bd64d1786",
      "user" : {
        "_type" : "user",
        "id" : 4
      },
      "name" : "token 2",
      "createdOn" : "2024-05-02T13:18:14.000+00:00",
      "createdBy" : "admin",
      "expiryDate" : "2024-12-28",
      "lastUsage" : "2024-06-10T16:00:07.000+00:00",
      "permissions" : "READ-WRITE"
    } ]
  },
  "_links" : {
    "self" : {
      "href" : "http://localhost:8080/api/rest/latest/users/4/tokens?page=0&size=20"
    }
  },
  "page" : {
    "size" : 20,
    "totalElements" : 2,
    "totalPages" : 1,
    "number" : 0
  }
}

Response fields

Path Type Description

_embedded.api-tokens

Array

the API tokens of the Test automation server user

page.size

Number

the page size for that query

page.totalElements

Number

total number of elements

page.totalPages

Number

how many pages can be browsed

page.number

Number

the page number

_links

Object

related links

post Create an API token for a Test automation server user

A POST to /users/{id}/tokens creates a new API token for the given Test automation server user id.

Path parameters

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

id

the Test automation server user id

HTTP request

POST /api/rest/latest/users/4/tokens HTTP/1.1
Content-Type: application/json
Accept: application/json
Content-Length: 97
Host: localhost:8080

{
  "name" : "token read write",
  "permissions" : "READ_WRITE",
  "expiry_date" : "2025-05-06"
}

Request fields

Path Type Description

name

String

the name of the API token (maximum 255 characters)

permissions

String

the permissions for the token ('READ' or 'READ_WRITE')

expiry_date

String

the expiry date for the token in the format 'YYYY-MM-DD' (it cannot exceed one year)

HTTP response

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

{
  "id" : 6,
  "uuid" : "9e02ea67-f7ae-4c22-80c5-cb6bd64d1786",
  "user" : {
    "_type" : "user",
    "id" : 4,
    "first_name" : "",
    "last_name" : null,
    "login" : null,
    "email" : "",
    "active" : true,
    "group" : null,
    "can_delete_from_front" : true,
    "teams" : [ ],
    "last_connected_on" : null,
    "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"
  },
  "name" : "token read write",
  "permissions" : "READ_WRITE",
  "expiry_date" : "2025-05-06T00:00:00.000+00:00",
  "created_on" : "2024-07-02T13:18:14.000+00:00",
  "created_by" : "admin",
  "last_usage" : null,
  "generated_token" : "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiIxIiwidXVpZCI6IjBmZmUxODdmLTAxYzctNGViZC05NjY5LWI0ODFlNzEyMGE1ZiIsInBlcm1pc3Npb25zIjoiUkVBRCIsImlhdCI6MTcyMTMwODc4OSwiZXhwIjoxNzUyNTM3NjAwfQ.qWlfn0D4R5-5PXwTpkArmjY2NOjpcE50dzwlaXkNbRu0K8CRS7YO-xsjPegup73nKxYQBQvbYJ_EPnTURRFQng"
}

Response fields

Path Type Description

id

Number

the ID of the API token

user

Object

the Test automation server user who owns the API token

uuid

String

the UUID of the API token

name

String

the name of the API token

created_on

String

the date when the API token was created

created_by

String

the user who has created the API token

permissions

String

the permissions associated with the API token

expiry_date

String

the expiry date of the API token

last_usage

String

the date when the API token was last used

generated_token

String

the generated API token that the user should keep secret

delete Delete an API token for a Test automation server user

A DELETE to users/tokens/{tokenId} deletes the token of a Test automation server user with the given id.

Path parameters

Table 1. /api/rest/latest/users/tokens/{tokenId}
Parameter Description

tokenId

the id of the token

HTTP request

DELETE /api/rest/latest/users/tokens/3 HTTP/1.1
Content-Type: application/json
Accept: application/json
Host: localhost:8080

HTTP response

HTTP/1.1 204 No Content