Add new filters to private access token API
Proposal
The API calls to retrieve the private access token (PAT) are currently very limited. Users can only retrieve a list of their PATs. Administrators only have the possibility to filter for a specific user via the parameter user_id. To filter the desired PATs according to certain criteria more quickly, some filter parameters would be very useful. Following a table with possible parameters and their function
Name | Parameter | Explanation |
---|---|---|
Is revoked | revoked=[true, false] |
All PATs where state matches parameter |
Created before |
created_before=[yyyy-mm-ddThh:mm:ss] If the date is specified but not the time, the default value of 00:00:00 is taken. |
All PATs which were created before given datetime |
Created after |
created_after=[yyyy-mm-ddThh:mm:ss] If the date is specified but not the time, the default value of 00:00:00 is taken. |
All PATs which were created after given datetime |
By scopes | scopes=[api, read_api, read_user, read_repository, write_repository, sudo] |
Filters PATs matching a comma-separated list of scopes (permission levels granted to the token) |
By Name | search=[name] |
Filters PATs by its name or a fraction of its name |
Last used before |
last_used_before=[yyyy-mm-ddThh:mm:ss] If the date is specified but not the time, the default value of 00:00:00 is taken. |
Filters PATs which were used before the given datetime |
Last used after |
last_used_after=[yyyy-mm-ddThh:mm:ss] If the date is specified but not the time, the default value of 00:00:00 is taken. |
Filters PATs which were used after the given datetime |
Is active | active=[true, false] |
Filters PATs which are either active or not |
The user should merge the filters as desired by linking them with a ‘&’. e.g.
Filter all PATs which are inactive and were created before 10.12.2021 09:00:05 am
[GET api/v4/personal_access_tokens?active=false&created_before=2021-12-10T09:00:05]
Edited by Andreas Deicha