Skip to content

#14800 API design: POST request for "Run live query" endpoint#15508

Merged
noahtalerman merged 18 commits intomainfrom
14800-live-query-api
Jan 11, 2024
Merged

#14800 API design: POST request for "Run live query" endpoint#15508
noahtalerman merged 18 commits intomainfrom
14800-live-query-api

Conversation

@rachaelshaw
Copy link
Copy Markdown
Member

@rachaelshaw rachaelshaw commented Dec 7, 2023

"Run live query" API updates based on @jrzmurray's PR #13002, to resolve issue #14800.

Since we have an existing endpoint (the one used by the Fleet UI) at POST /api/v1/fleet/queries/run, we aren't able to simply update the publicly-documented endpoint's method from GET to POST without a breaking change.

Instead, this proposes the following API changes:

  • New API endpoint: POST /api/v1/fleet/queries/:id/run. This becomes the publicly documented “Run live query” REST API endpoint. The differences are:
    • POST HTTP method instead of GET.
    • Targets 1 query at a time.
    • Simpler response structure (since it targets a single query): no separate summary and live_query_results; the contents of both have been moved to the top level.
  • The existing “Run live query” endpoint is left intact for backwards compatibility, and linked to from the documentation section for the new endpoint.

fleet-release
fleet-release previously approved these changes Dec 7, 2023
Comment thread docs/REST API/rest-api.md Outdated
fleet-release
fleet-release previously approved these changes Dec 7, 2023
Comment thread docs/REST API/rest-api.md Outdated
Comment thread docs/REST API/rest-api.md Outdated
fleet-release
fleet-release previously approved these changes Dec 7, 2023
Comment thread docs/Contributing/API-for-contributors.md Outdated
Comment thread docs/REST API/rest-api.md Outdated
fleet-release
fleet-release previously approved these changes Dec 8, 2023
Comment thread docs/REST API/rest-api.md Outdated

### Run live query

> This updated API endpoint replaced `GET /api/v1/fleet/queries/run` in Fleet 4.x.x, for improved compatibility with many HTTP clients. The [deprecated endpoint](https://github.com/fleetdm/fleet/blob/fleet-v4.41.1/docs/REST%20API/rest-api.md#run-live-query) is maintained for backwards compatibility.
Copy link
Copy Markdown
Member Author

@rachaelshaw rachaelshaw Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: replace 4.x.x with actual release version when this is scheduled into a sprint

Comment thread docs/REST API/rest-api.md Outdated
fleet-release
fleet-release previously approved these changes Dec 8, 2023
Comment thread docs/REST API/rest-api.md Outdated
fleet-release
fleet-release previously approved these changes Dec 15, 2023
fleet-release
fleet-release previously approved these changes Dec 15, 2023
fleet-release
fleet-release previously approved these changes Dec 18, 2023
Comment thread docs/REST API/rest-api.md Outdated
Comment thread docs/REST API/rest-api.md Outdated
Co-authored-by: Rachael Shaw <r@rachael.wtf>
Comment thread docs/REST API/rest-api.md Outdated
@noahtalerman noahtalerman marked this pull request as ready for review January 11, 2024 19:26
@noahtalerman
Copy link
Copy Markdown
Member

Marked this PR as ready for review because #14800 was shipped 🎉

Co-authored-by: Rachael Shaw <r@rachael.wtf>
@noahtalerman noahtalerman merged commit 7c84588 into main Jan 11, 2024
@noahtalerman noahtalerman deleted the 14800-live-query-api branch January 11, 2024 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants