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

RESTFUL URL Endpoints need re-thinking #127

Open
bthornton505 opened this issue Jun 5, 2019 · 3 comments
Open

RESTFUL URL Endpoints need re-thinking #127

bthornton505 opened this issue Jun 5, 2019 · 3 comments
Assignees
Labels
backend Medium Medium difficult tasks
Milestone

Comments

@bthornton505
Copy link
Collaborator

I was talking to Hunter about the current backend endpoints and I feel that we could have them be more readable. I realize this might be a nit-pick but it could make a big difference for consuming the api properly and having RESTFUL endpoints.

Here's an example of what they should look like:

gsndb/user/1/students

This url expresses that we should be on a page that shows user 1's students. Specifically all students associated with user 1's account. If we wanted to navigate to another user's students we should be able to change the primary key to say user/5/students in the url and be redirected to their students. Whether we want that functionality is another question. But our endpoints should be very explicit in where we are currently located in the application.

If you are unsure about my suggestion then I would be happy to talk about it over discord/github/in-person.

@hannahkamundson
Copy link
Collaborator

Ok that makes sense! So are you saying you want user 1 to have access to user 2’s students? Right now the endpoints don’t have multi layers. It’s just students/1 or school/2. Thoughts??

@bthornton505
Copy link
Collaborator Author

Well it really depends on what we want the user to have access to but for this use case I'd say we don't want the user to have access to other user's students. I made that example to express how easy the url should be to read.

I realize we don't have nested routes right now but we should start thinking about which ones we should create so we can keep our endpoints RESTful on both the front and back end.

So we could always have the user in the url such as: gsndev.com/gsndb/:username

Then when they click on different tabs it would append the url: gsndev.com/gsndb/:username/students

With this example we've removed the users primary key and inserted the users first name into the url. We could keep doing this for other sections where it makes sense.

ex:
gsndev.com/gsndb/school/1/students
gsndev.com/gsndb/student/5/grades => You could also make slugs for the students like bthornton, where you take first initial and append the last name

All suggestions for what they could look like but our url should work similar to the breadcrumbs and almost be read as a sentence.

Let me know if anything doesn't make sense.

@hannahkamundson
Copy link
Collaborator

Ah okay makes sense to try and make them more restful.
Here are the current urls on the
Program/
Program/int
Student/
Student/int
School/
School/int
District/
District/int
Course/
Course/int

Are you saying for each of these you want me to put the username in front of it? I can do that! Just thinking that it seems unnecessary since it isn’t telling us more info? All of these urls will be split between all that they have access to and all that are their students. For that I will add in something before to identify. Just lmk your thought process/what you specifically want me to do!

@hannahkamundson hannahkamundson added this to the Post MVP milestone Jun 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Medium Medium difficult tasks
Projects
None yet
Development

No branches or pull requests

4 participants