-
Notifications
You must be signed in to change notification settings - Fork 16
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
Inconsistencies in the API #207
Comments
I just played with the swagger interface a bit. Seems like there is an issue with autentication also. I am trying an arbitrary endpoint, let's say Swagger generates: Curl
Request URL
This results in the following error: Response body
The point here is, that swagger sends Authorization as a keyword in the HTTP header, where the cnaas-nms API expects the keyword Bearer. The swagger interface is a nice human-friendly way to get an overview of the API and play with it, it is interactive documentation. So I would definitely support looking into these issues, and also putting a reference to swagger into the written docs. |
To sum up, I tried to generate some actionable tasks from @hmpf's accurate report. Documentation/swagger:
For API consistency:
Regarding the last bit you mentioned @hmpf, cnaas-nms does API versioning via the URL: |
Yeah I'm not used to the base url being split out, found it today.
I only did a cursory skim so there's no doubt other things. |
Did you try pasting in "Bearer: <jwt token>" and not just the token? |
We should also differentiate PUT and PATCH methods, today only PUT is used but functions as PATCH should |
While testing the automated dev-setup for the frontend I wound up taking a look at the swagger-interface (runs on localhost:443) to the backend API. I have some (pedantic) comments.
In most cases you have two endpoints to work with one type of data. For instance
/devices
to list all, and/device/<something>
. But not for groups, there you only have/groups
.Furthermore, the descriptions of several of the endpoints seems copy-pasted. Compare
/job
API for handling jobs/jobs
API for handling jobs/joblock
API for handling jobsThird, why
/joblocks
instead of/job_locks
when you have/device_<something>
? I read it as "job blocks" at first.Fourth, there is no example response body, which is very useful for somebody trying to figure out the API without having possibly dangerous access. I assume the swagger is auto-generated and that it is a hassle to extend it to do the right thing but it is very much worth it, in my experience.
Fifth, how are you planning to do versioning of the API? I assure you, you'll want to have a way to version the API.
The text was updated successfully, but these errors were encountered: