fleetdm / fleet

Open-source platform for IT, security, and infrastructure teams. (Linux, macOS, Chrome, Windows, cloud, data center)
https://fleetdm.com
Other
3.16k stars 433 forks source link

Return local users and Fleet labels in GET /hosts (list hosts) API endpoint #20795

Open ddribeiro opened 4 months ago

ddribeiro commented 4 months ago

User stories

noahtalerman commented 4 months ago

make a single API call to retrieve relevant information about all hosts.

@ddribeiro what will they do with this data once it's in BI?

Will they click around in BI to view users/labels for specific host? (this they can do in Fleet today)

Are they going to build a graph/report? If yes, what will that report look like?

noahtalerman commented 2 months ago

@ddribeiro do you know why the customer wants labels?

If I'm understanding correctly they're importing Fleet data into some asset management tool like ServiceNow. What would they use labels for? users makes sense for this use case.

noahtalerman commented 2 months ago

Hey @ddribeiro and @zayhanlon heads up, we peeled a user story here off of this request and brought the story into the design sprint.

noahtalerman commented 1 month ago

Moved the original issue description here for safekeeping:

Problem

customer-stazzema is using the Fleet API to ingest data into their BI tools. Currently, they make a call to list hosts (GET /api/v1/fleet/hosts) to retrieve a list of all their hosts. Because this endpoint intentionally omits some data to reduce the size of the response, they need to make an additional API call to the get host (GET /api/v1/fleet/hosts/:id) endpoint for each host to get all the data they need.

Specifically, users and labels are the two pieces of information not included in GET /api/v1/fleet/hosts that is included in GET /api/v1/fleet/hosts/:id.

Making multiple API calls is a pain point and reduces efficiency in their workflow.

What have you tried?

Currently the GET /api/v1/fleet/hosts endpoint supports query parameters for:

customer-stezzema checked the Fleet documentation to see if they were able to pass a query parameter to include users and labels in the response but this functionality does not exist.

Potential solutions

Adding additional query parameters (specifically users and labels for this request) to the GET /api/v1/fleet/hosts endpoint would allow Fleet API users to customize the data they get back in their response. There is precedent for doing this with the existing query parameters. populate_software in particular would generate a much larger response than the specific ask for this proposal and is currently supported.

What is the expected workflow as a result of your proposal?

As a result of this proposal, using the Fleet API to ingest data into BI tools will be simplified. It would be possibly to make a single API call to retrieve relevant information about all hosts.
noahtalerman commented 1 month ago

Hey @pintomi1989, when you get the chance can you please add the Gong snippet for stazzema? Thanks :)