This repository has been archived by the owner on Dec 9, 2022. It is now read-only.
Restructuring of endpoints #38
Locked
marcauberer
started this conversation in
Ideas
Replies: 2 comments
-
Thanks for this great idea @marcauberer which seems fair enough and the examples you gave confirm that this will really tidy up our URLs. What do you think, @Niklas-23? I guess, we can tackle this in our current sprint. |
Beta Was this translation helpful? Give feedback.
0 replies
-
addressed by #62 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Now, that we have an identification transmission with every authenticated request, we could think about restructuring our endpoints, so that the frontend does not have to pass the user id redundantly. This would result in a more lucid API structure and more intuitive urls.
Example:
Up to now, the frontend retrieves all polls for one user by calling this endpoint:
https://<api-host>/users/<user-id>/polls
We could improve it by removing the redundant user id:
https://<api-host>/polls
Another example:
Old endpoint:
https://<api-host>/users/<user-id>/polls/<poll-id>/item/<item-id>
New endpoint:
https://<api-host>/polls/<poll-id>/<item-id>
At the moment, I am restructuring the frontend to ensure modularity and to match the MVVM model. In the wake of the restructuring, the code for the server communitcation will be extracted to other files. The mentioned method of restructuring the endpoints might avoid passing additional parameters to those network observer methods.
What do you think about this approach?
Beta Was this translation helpful? Give feedback.
All reactions