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

API design: Software self-service #20223

Merged
merged 56 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
4bf3652
Update rest-api.md
marko-lisica Mar 26, 2024
b0eed94
Update API-for-contributors.md
marko-lisica Mar 26, 2024
a88a8ae
Update API-for-contributors.md
marko-lisica Apr 1, 2024
2d2e30f
Update rest-api.md
marko-lisica Apr 1, 2024
6786655
Update rest-api.md
marko-lisica Apr 1, 2024
267faac
Update rest-api.md
marko-lisica Apr 1, 2024
781d19f
Update rest-api.md
marko-lisica Apr 1, 2024
1212c2d
Update rest-api.md
marko-lisica Apr 1, 2024
7629722
Update rest-api.md
marko-lisica Apr 1, 2024
1036ca3
Update rest-api.md
marko-lisica Apr 1, 2024
73a7fe5
Update rest-api.md
marko-lisica Apr 1, 2024
9e0e417
Update rest-api.md
marko-lisica Apr 2, 2024
012256f
Update rest-api.md
marko-lisica Apr 2, 2024
e3a06a5
Update rest-api.md
marko-lisica Apr 2, 2024
e765591
Update rest-api.md
marko-lisica Apr 4, 2024
a54d92c
Update rest-api.md
marko-lisica Apr 5, 2024
fd09eee
Update API-for-contributors.md
marko-lisica Apr 5, 2024
c786324
Update API-for-contributors.md
marko-lisica Apr 5, 2024
93be1b1
Update rest-api.md
marko-lisica Apr 5, 2024
0e1fb7e
Update rest-api.md
marko-lisica Apr 5, 2024
d83cd1d
Update rest-api.md
marko-lisica Apr 9, 2024
8cb1949
Update docs/REST API/rest-api.md
marko-lisica Apr 12, 2024
84662bf
Update rest-api.md
marko-lisica Apr 12, 2024
4e123d0
Update rest-api.md
marko-lisica Apr 12, 2024
2e51e98
Update rest-api.md
marko-lisica Apr 12, 2024
19cf307
Update rest-api.md
marko-lisica Apr 15, 2024
c0d3c50
Update rest-api.md
marko-lisica Apr 15, 2024
d88d7a0
Update docs/REST API/rest-api.md
marko-lisica Apr 15, 2024
8513c56
Update rest-api.md
marko-lisica Apr 15, 2024
262c113
Update API-for-contributors.md
marko-lisica Apr 15, 2024
22ba0eb
Update rest-api.md
marko-lisica Apr 23, 2024
4b29f3b
Update rest-api.md
marko-lisica Apr 24, 2024
ab0ff94
Update rest-api.md
marko-lisica Apr 24, 2024
45a0a1b
Update rest-api.md
marko-lisica Apr 24, 2024
45ac3c0
Update rest-api.md
marko-lisica Apr 24, 2024
f0cc5d2
Update API-for-contributors.md
marko-lisica Apr 24, 2024
e0ccdd6
Update API-for-contributors.md
marko-lisica Apr 24, 2024
2b71c8e
Update API-for-contributors.md
marko-lisica Apr 29, 2024
e5ef0c6
Update API-for-contributors.md
marko-lisica Apr 29, 2024
ee681e1
Update rest-api.md
marko-lisica Apr 29, 2024
5cbd9b2
Update API-for-contributors.md
marko-lisica Apr 30, 2024
cbdd0e0
Update rest-api.md
marko-lisica Apr 30, 2024
1ab8bf6
Update API-for-contributors.md
marko-lisica Apr 30, 2024
267bf4d
Update rest-api.md
marko-lisica Apr 30, 2024
23970e2
Update API-for-contributors.md
marko-lisica Apr 30, 2024
75bd421
Update API-for-contributors.md
marko-lisica Apr 30, 2024
985a301
Update API-for-contributors.md
marko-lisica Apr 30, 2024
22bc63a
Merge branch 'api-changes-deploy-sec-agents' into api-self-service-de…
marko-lisica Apr 30, 2024
1a4e5bf
Update docs/REST API/rest-api.md
marko-lisica May 21, 2024
07f0e0b
Update API-for-contributors.md
marko-lisica May 28, 2024
3e1926a
Merge branch 'main' into api-self-service-design
marko-lisica Jul 4, 2024
4dc068c
Update docs/REST API/rest-api.md
marko-lisica Jul 4, 2024
3fc8c3d
Update rest-api.md
marko-lisica Jul 4, 2024
3d0c4a3
Update rest-api.md
marko-lisica Jul 4, 2024
8eed151
Update docs/REST API/rest-api.md
marko-lisica Jul 5, 2024
881a765
Update docs/REST API/rest-api.md
marko-lisica Jul 5, 2024
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
26 changes: 23 additions & 3 deletions docs/Contributing/API-for-contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -1381,7 +1381,7 @@ If the `name` is not already associated with an existing team, this API route cr
| mdm.windows_settings | object | body | The Windows-specific MDM settings. |
| mdm.windows_settings.custom_settings | list | body | The list of objects consists of a `path` to XML files and `labels` list of label names. |
| scripts | list | body | A list of script files to add to this team so they can be executed at a later time. |
| software | list | body | An array of software objects. Each object consists of:`url`- URL to the software package (PKG, MSI, EXE or DEB),`install_script` - command that Fleet runs to install software, `pre_install_query` - condition query that determines if the install will proceed, and `post_install_script` - script that runs after software install. |
| software | list | body | An array of software objects. Each object consists of:`url`- URL to the software package (PKG, MSI, EXE or DEB),`install_script` - command that Fleet runs to install software, `pre_install_query` - condition query that determines if the install will proceed, `post_install_script` - script that runs after software install, and `self_service` boolean. |
| mdm.macos_settings.enable_disk_encryption | bool | body | Whether disk encryption should be enabled for hosts that belong to this team. |
| force | bool | query | Force apply the spec even if there are (ignorable) validation errors. Those are unknown keys and agent options-related validations. |
| dry_run | bool | query | Validate the provided JSON for unknown keys and invalid value types and return any validation errors, but do not apply the changes. |
Expand Down Expand Up @@ -1463,6 +1463,7 @@ If the `name` is not already associated with an existing team, this API route cr
"url": "https://cdn.zoom.us/prod/5.16.10.26186/x64/ZoomInstallerFull.msi",
"pre_install_query": "SELECT 1 FROM macos_profiles WHERE uuid='c9f4f0d5-8426-4eb8-b61b-27c543c9d3db';",
"post_install_script": "sudo /Applications/Falcon.app/Contents/Resources/falconctl license 0123456789ABCDEFGHIJKLMNOPQRSTUV-WX",
"self_service": true
}
]
}
Expand Down Expand Up @@ -2515,6 +2516,7 @@ Lists the software installed on the current device.
| Name | Type | In | Description |
| ----- | ------ | ---- | ---------------------------------- |
| token | string | path | The device's authentication token. |
| self_service | bool | query | Filter `self_service` software. |
| query | string | query | Search query keywords. Searchable fields include `name`. |
| page | integer | query | Page number of the results to fetch.|
| per_page | integer | query | Results per page.|
Expand All @@ -2535,7 +2537,6 @@ Lists the software installed on the current device.
"id": 121,
"name": "Google Chrome.app",
"source": "apps",
"bundle_identifier": "com.google.Chrome",
"status": "failed",
"last_install": {
"install_uuid": "8bbb8ac2-b254-4387-8cba-4d8a0407368b",
Expand All @@ -2554,7 +2555,6 @@ Lists the software installed on the current device.
"id": 143,
"name": "Firefox.app",
"source": "apps",
"bundle_identifier": "com.google.Chrome",
"status": null,
"last_install": null,
"installed_versions": [
Expand All @@ -2574,6 +2574,26 @@ Lists the software installed on the current device.
}
```

#### Install self-service software

Install self-service software on macOS, Windows, or Linux (Ubuntu) host. The software must have a `self_service` flag `true` to be installed.

`POST /api/v1/fleet/device/{token}/software/install/:software_title_id`

##### Parameters

| Name | Type | In | Description |
| ----- | ------ | ---- | ---------------------------------- |
| token | string | path | **Required**. The device's authentication token. |
| software_title_id | string | path | **Required**. The software title's ID. |

##### Example

`POST /api/v1/fleet/device/22aada07-dc73-41f2-8452-c0987543fd29/software/install/123`

##### Default response

`Status: 202`

#### Get device's policies

Expand Down
26 changes: 19 additions & 7 deletions docs/REST API/rest-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4300,6 +4300,7 @@ OS vulnerability data is currently available for Windows and macOS. For other pl
"id": 121,
"name": "Google Chrome.app",
"package_available_for_install": "GoogleChrome.pkg",
"self_service": true,
"source": "apps",
"status": "failed",
"last_install": {
Expand All @@ -4319,6 +4320,7 @@ OS vulnerability data is currently available for Windows and macOS. For other pl
"id": 134,
"name": "Falcon.app",
"package_available_for_install": "FalconSensor-6.44.pkg",
"self_service": false,
"source": "",
"status": null,
"last_install": null,
Expand All @@ -4327,7 +4329,6 @@ OS vulnerability data is currently available for Windows and macOS. For other pl
{
"id": 147,
"name": "Firefox.app",
"package_available_for_install": null,
"source": "apps",
"bundle_identifier": "org.mozilla.firefox",
"status": null,
Expand Down Expand Up @@ -8571,9 +8572,10 @@ Add a software package to install on macOS, Windows, and Linux (Ubuntu) hosts.
| ---- | ------- | ---- | -------------------------------------------- |
| software | file | form | **Required**. Installer package file. Supported packages are PKG, MSI, EXE, and DEB. |
| team_id | integer | form | **Required**. The team ID. Adds a software package to the specified team. |
| install_script | string | form | Command that Fleet runs to install software. If not specified Fleet runs [default install command](#TODO-link-to-docs) for each package type. |
| install_script | string | form | Command that Fleet runs to install software. If not specified Fleet runs [default install command](https://github.com/fleetdm/fleet/tree/f71a1f183cc6736205510580c8366153ea083a8d/pkg/file/scripts) for each package type. |
| pre_install_query | string | form | Query that is pre-install condition. If the query doesn't return any result, Fleet won't proceed to install. |
| post_install_script | string | form | The contents of the script to run after install. If the specified script fails (exit code non-zero) software install will be marked as failed and rolled back. |
| self_service | boolean | form | Self-service software is optional and can be installed by the end user. |

#### Example

Expand All @@ -8593,6 +8595,9 @@ Content-Type: multipart/form-data; boundary=------------------------d8c247122f59
Content-Disposition: form-data; name="team_id"
1
--------------------------d8c247122f594ba0
Content-Disposition: form-data; name="self_service"
true
--------------------------d8c247122f594ba0
Content-Disposition: form-data; name="install_script"
sudo installer -pkg /temp/FalconSensor-6.44.pkg -target /
--------------------------d8c247122f594ba0
Expand Down Expand Up @@ -8625,8 +8630,8 @@ Download a software package.

| Name | Type | In | Description |
| ---- | ------- | ---- | -------------------------------------------- |
| software_title_id | integer | path | **Required**. The ID of the software title to download software package.|
| team_id | integer | form | **Required**. The team ID. Downloads a software package added to the specified team. |
| software_title_id | integer | path | **Required**. The ID of the software title to download software package.|
| team_id | integer | query | **Required**. The team ID. Downloads a software package added to the specified team. |
| alt | integer | query | **Required**. If specified and set to "media", downloads the specified software package. |

#### Example
Expand Down Expand Up @@ -8657,7 +8662,7 @@ Delete a software package.

| Name | Type | In | Description |
| ---- | ------- | ---- | -------------------------------------------- |
| software_title_id | integer | path | **Required**. The ID of the software title for the software package to delete. |
| software_title_id | integer | path | **Required**. The ID of the software title for the software package to delete. |
| team_id | integer | query | **Required**. The team ID. Deletes a software package added to the specified team. |

#### Example
Expand All @@ -8678,7 +8683,7 @@ Get the results of a software installation.

| Name | Type | In | Description |
| ---- | ------- | ---- | -------------------------------------------- |
| install_uuid | string | path | **Required**. The installation UUID of the software.|
| install_uuid | string | path | **Required**. The software installation UUID.|

#### Example

Expand Down Expand Up @@ -8721,10 +8726,11 @@ Get a list of all software.
| team_id | integer | query | _Available in Fleet Premium_. Filters the software to only include the software installed on the hosts that are assigned to the specified team. |
| vulnerable | bool | query | If true or 1, only list software that has detected vulnerabilities. Default is `false`. |
| available_for_install | bool | query | If `true` or `1`, only list software that is available for install (added by the user). Default is `false`. |
| self_service | bool | query | If `true` or `1`, only lists self-service software. Default is `false`. |

#### Example

`GET /api/v1/fleet/software/titles`
`GET /api/v1/fleet/software/titles?team_id=3`

##### Default response

Expand All @@ -8739,6 +8745,7 @@ Get a list of all software.
"id": 12,
"name": "Firefox.app",
"software_package": "FirefoxInstall.pkg",
"self_service": true,
"versions_count": 3,
"source": "apps",
"browser": "",
Expand All @@ -8765,6 +8772,7 @@ Get a list of all software.
"id": 22,
"name": "Google Chrome.app",
"software_package": null,
"self_service": false,
"versions_count": 5,
"source": "apps",
"browser": "",
Expand Down Expand Up @@ -8796,6 +8804,7 @@ Get a list of all software.
"id": 32,
"name": "1Password – Password Manager",
"software_package": null,
"self_service": false,
"versions_count": 1,
"source": "chrome_extensions",
"browser": "chrome",
Expand Down Expand Up @@ -8919,10 +8928,13 @@ Returns information about the specified software. By default, `versions` are sor
"software_package": {
"name": "FalconSensor-6.44.pkg",
"version": "6.44",
"installer_id": 23,
"team_id": 3,
"uploaded_at": "2024-04-01T14:22:58Z",
"install_script": "sudo installer -pkg /temp/FalconSensor-6.44.pkg -target /",
"pre_install_query": "SELECT 1 FROM macos_profiles WHERE uuid='c9f4f0d5-8426-4eb8-b61b-27c543c9d3db';",
"post_install_script": "sudo /Applications/Falcon.app/Contents/Resources/falconctl license 0123456789ABCDEFGHIJKLMNOPQRSTUV-WX",
"self_service": true,
"status": {
"installed": 3,
"pending": 1,
Expand Down
Loading