I’m trying to use the API v2 /api/v2/authorizations/groups
Trying to access the [GET] Group Search function (/api/v2/authorizations/groups)
The API v2 works fine and returns what its supposed to, if it finds a group with the [GET] group search function json + statuscode 200.
However, it also returns statuscode 200 but with an empty response if the group doesn’t exist/not found. According to the api v2 documentation should return 404 with { “message”: “…” }.
Example call (simple get call with Invoke-RestMethod):
In reality, with the API you’re using searching for a group (you could type an incomplete group name of an existing group and if the search is working right, a group would appear in the results).
As noted for the q parameter
Filter on name. This parameter can either perform an exact match, or a partial match (contains), it is case insensitive.
So I don’t think returning a 404 would make sense… and with that said, that makes it very confusing we document a 404 case. I’ll flag this for an expert!
Thanks, the 404 status seems kind of confusing if it wont happen.
In true hateoas spirit, I see status 200 and I always seem to get a json back with group count 0 for the empty responses; I think it makes sense to use ($Response.page.total -gt 0) in my code in stead of StatusCode 200/404.