hzeller / stuff-org

Organize electronic components. Or other stuff.
34 stars 11 forks source link

Add APIs for querying overall and individual item status #11

Closed IamTechknow closed 6 years ago

IamTechknow commented 6 years ago

I added APIs that serve as endpoint equivalents for the status page and the read-only page mode. These may be useful for non-browser clients.

I adhered to the coding style as much as possible, and took care of out-of-bound cases by validating the input and setting them to default values if needed instead of returning error 400 for a bad request. I chose to do it this way because I realize a 404 error is done similarity for images. The user sees a placeholder image instead of a broken image icon for items that don't exist.

hzeller commented 6 years ago

This looks pretty cool.

Can you also add a description of the new API calls in the toplevel README.md, similar to the Sample query right now ?

At least it would be good for people to know which endpoints exist and parameters are accepted. Maybe a small table ?

hzeller commented 6 years ago

FYI, I have patched parts.noisebridge.net to contain your changes, e.g. https://parts.noisebridge.net/api/info?id=188

hzeller commented 6 years ago

(but make sure to finish this pull request, otherwise the changes will not be permanent)

IamTechknow commented 6 years ago

Thanks for the reminder and patching. I added a table and new API samples to the README as well as fixing my comments. It should look good now

hzeller commented 6 years ago

Thanks, merged!