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

List Api returns 404 NotFound instead of 200 OK with empty list - AppRole Roles (and possibly others) #1958

Closed
rajanadar opened this issue Oct 2, 2016 · 2 comments

Comments

@rajanadar
Copy link
Contributor

Vault Version: 0.6.1
Sample API: /auth/approle/role?list=true

Steps:

  1. Startup Vault
  2. Enable an AppRole auth backend
  3. Query the existing approles in the backend using the API: /auth/approle/role?list=true

Observed Result:

404 Not Found (WebException) is observed.

Expected Result:

would it be better if the API returned a 200 OK with zero results?
404 would make sense for a single REST resource. when you are looking for it with an id.

In case of a collection of resources, an empty list of roles sounds more useful for the callers. (and probably aligns to how REST Apis work)
Otherwise the callers now need to catch 404 exceptions.. and expose out an empty list.

p.s. i verified it for the AppRoles api, but this may be applicable to other List APIs as well.

@rajanadar
Copy link
Contributor Author

also, should the api be /auth/approle/roles instead of /auth/approle/role? (plural roles)
The documentation page mentions singular.

@jefferai
Copy link
Member

jefferai commented Oct 2, 2016

See #1365

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

No branches or pull requests

2 participants