Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

23971 Proposed API and schema changes #25013

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions docs/Contributing/API-for-contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- [Setup](#setup)
- [Scripts](#scripts)
- [Software](#software)
- [Users](#users)

> These endpoints are used by the Fleet UI, Fleet Desktop, and `fleetctl` clients and frequently change to reflect current functionality.

Expand Down Expand Up @@ -4197,3 +4198,101 @@ Content-Disposition: attachment
Content-Length: <length>
Body: <blob>
```
## Users

### Update user-specific UI settings

`PATCH /api/v1/fleet/users/:id`

#### Parameters

| Name | Type | In | Description |
| --------- | ------ | ----- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| settings | object | body | The updated user settings. |

#### Example

`PATCH /api/v1/fleet/users/1`
```json
{
"hidden_host_columns": ["hostname"]
}
```

##### Default response
* Note that user settings are *not* included in this response. See below `GET`s for how to get user settings.
`Status: 200`
```json
{
"user": {
"created_at": "2025-01-08T01:04:23Z",
"updated_at": "2025-01-09T00:08:19Z",
"id": 1,
"name": "Sum Bahdee",
"email": "[email protected]",
"force_password_reset": false,
"gravatar_url": "",
"sso_enabled": false,
"mfa_enabled": false,
"global_role": "admin",
"api_only": false,
"teams": []
}
}
```

### Include settings when getting a user

`GET /api/v1/fleet/users/:id?include_ui_settings=true`

Use of `include_ui_settings=true` is considered the contributor API functionality – without that
param, this endpoint is considered a documented REST API endpoint

#### Parameters

| Name | Type | In | Description |
| ------------------- | ------ | ----- | --------------------------------------------------------------------------------------------------|
| include_ui_settings | bool | query | If `true`, will include the user's settings in the response. For now, this is a single ui setting.

#### Example

`GET /api/v1/fleet/users/2/?include_ui_settings=true`

##### Default response

`Status: 200`
```json
{
"user": {...},
"available_teams": {...}
"settings": {"hidden_host_columns": ["hostname"]},
}
```

### Include settings when getting current user

`GET /api/v1/fleet/me/?include_ui_settings=true`

Use of `include_ui_settings=true` is considered the contributor API functionality – without that
param, this endpoint is considered a documented REST API endpoint

#### Parameters

| Name | Type | In | Description |
| ------------------- | ------ | ----- | --------------------------------------------------------------------------------------------------|
| include_ui_settings | bool | query | If `true`, will include the user's settings in the response. For now, this is a single ui setting.

#### Example

`GET /api/v1/fleet/me?include_ui_settings=true`

##### Default response

`Status: 200`
```json
{
"user": {...},
"available_teams": {...}
"settings": {"hidden_host_columns": ["hostname"]},
}
```
9 changes: 8 additions & 1 deletion docs/REST API/rest-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,14 @@ Retrieves the user data for the authenticated user.
"gravatar_url": "",
"sso_enabled": false,
"teams": []
}
},
"available_teams" : [
{
"id": 1,
"name": "Workstations",
"description": "Employee workstations"
}
],
}
```

Expand Down
Loading