Skip to content
This repository has been archived by the owner on Apr 9, 2022. It is now read-only.

Flask Blueprints #73

Open
angadgarg25 opened this issue Mar 20, 2019 · 0 comments
Open

Flask Blueprints #73

angadgarg25 opened this issue Mar 20, 2019 · 0 comments

Comments

@angadgarg25
Copy link
Member

This is super low-priority, but a really easy fix if you're editing the backend views again. Flask Blueprints allow you to add a url_prefix parameter when constructing your Blueprint (the link says how near the top). This means you can type /field_partner once instead of 5 times.

Also while none of our APIs really conform fully to REST standards, there are some parts of the standard we try to stick to. The only issue I saw with this was your messages endpoint which was plural instead of singular /messages instead of /message. Your other get all requests were singular, so I would change the messages one as well.

Finally the last thing. This may be fine as is, but I'm not sure so just writing it down. I haven't written too many endpoints, but I've never really seen a case to use multiple url path parameters like you have here and also in your PM file. Usually with PUT requests, you'd use these to find the object, but then use query parameters (ex. ?status=...) for how to update the object, even if status is the only update-able field. The only case you'd use multiple in my opinion, is if you have a nested object, but you'd still use query parameters after with how you're updating that object. I might be totally wrong on this one though, so I'd double check before making this change.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant