Sign in or sign up before continuing. Don't have an account yet? Register now to get started.
Register now

New personal access token API endpoint 'id'

Proposal

To view the properties of a personal access token (PAT) via the API, the user currently needs to retrieve a list of all his PATs. He can do this by submitting a valid PAT via the API call. The admin can additionally display the PATs of a specific user using the user_id parameter, but a complete list of all PAT properties always comes with it. In order to not always have to query the complete list, it would be possible to query only a specific PAT by providing a parameter that gets the PAT by its id. The API call looks like this:

[GET api/v4/personal_access_tokens/id]

Command:

curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/personal_access_tokens/3"

Trying to access a PAT that does not exist should return a 404 error not found and an unauthorized one should return the 401.

Implementation Plan

  • Add a new route to lib/api/personal_access_token.rb which receives a parameter :id
Edited May 16, 2022 by Andreas Deicha
Assignee Loading
Time tracking Loading