Skip to main content

Hello,

 

I’m encountering an issue when trying to retrieve the ID of a host category using the following API route:

 

{{baseUrl}}/configuration/hosts/categories?search={"name":"X"}

 

If the host category X is not linked to any host, the API returns an empty result. However, if I don’t use the search parameter, the API lists all my categories — including the one named X, even if it’s empty.

 

My goal is to retrieve the ID of this category to use it in another script.

 

As a workaround, I can fetch all categories without using the search parameter and then filter the results manually, but that requires handling pagination and parsing the entire result set, which is not ideal.

 

I don’t understand why the category is returned when calling the endpoint without search, but not when using the search filter. To me, this behavior could be considered a bug.

 

Has anyone experienced this before, or does someone have more information on this?

 

Thanks in advance!

Be the first to reply!

Reply