diff options
Diffstat (limited to 'doc/api/users.md')
-rw-r--r-- | doc/api/users.md | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/doc/api/users.md b/doc/api/users.md index 2b4099227bc..91168c05dbe 100644 --- a/doc/api/users.md +++ b/doc/api/users.md @@ -831,18 +831,21 @@ Example response: ## Retrieve user personal access tokens It retrieves every personal access token of the user. Note that only administrators can do this. +This function takes pagination parameters `page` and `per_page` to restrict the list of personal access tokens. ``` -GET /users/:user_id/personal_access_tokens +GET /users/:id/personal_access_tokens ``` Parameters: | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `user_id` | integer | yes | The ID of the user | +| `id` | integer | yes | The ID of the user | +| `state` | string | no | filter tokens based on state (all, active, inactive) | +| `impersonation` | boolean | no | The impersonation flag of the personal access token | -An example: +Example response: ```json [ { @@ -852,45 +855,25 @@ An example: "expires_at": "2017-01-04", "scopes": ['api'], "active": true, - "impersonation": false, + "impersonation": true, "token": "9koXpg98eAheJpvBs5tK" } ] ``` -In addition, you can filter tokens based on state: `all`, `active` and `inactive` - -``` -GET /users/:user_id/personal_access_tokens?state=all -``` - -``` -GET /users/:user_id/personal_access_tokens?state=active -``` - -``` -GET /users/:user_id/personal_access_tokens?state=inactive -``` - -Finally, you can filter based on impersonation: `true` or `false`. - -``` -GET /users/:user_id/personal_access_tokens?impersonation=true -``` - ## Show a user personal access token It shows a user's personal access token. Note that only administrators can do this. ``` -GET /users/:user_id/personal_access_tokens/:personal_access_token_id +GET /users/:id/personal_access_tokens/:personal_access_token_id ``` Parameters: | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `user_id` | integer | yes | The ID of the user | +| `id` | integer | yes | The ID of the user | | `personal_access_token_id` | integer | yes | The ID of the personal access token | ## Create a personal access token @@ -901,14 +884,14 @@ both API calls and Git reads and writes. The user will not see these tokens in h settings page. ``` -POST /users/:user_id/personal_access_tokens +POST /users/:id/personal_access_tokens ``` Parameters: | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `user_id` | integer | yes | The ID of the user | +| `id` | integer | yes | The ID of the user | | `name` | string | yes | The name of the personal access token | | `expires_at` | date | no | The expiration date of the personal access token | | `scopes` | array | no | The array of scopes of the personal access token | @@ -919,12 +902,12 @@ Parameters: It revokes a personal access token. Note that only administrators can revoke impersonation tokens. ``` -DELETE /users/:user_id/personal_access_tokens/:personal_access_token_id +DELETE /users/:id/personal_access_tokens/:personal_access_token_id ``` Parameters: | Attribute | Type | Required | Description | | --------- | ---- | -------- | ----------- | -| `user_id` | integer | yes | The ID of the user | +| `id` | integer | yes | The ID of the user | | `personal_access_token_id` | integer | yes | The ID of the personal access token | |