#Rest Api Endpoints

12 messages · Page 1 of 1 (latest)

frigid fiber
#

Hi guys, i have a theoretical question that it came when i start building a auto repair shop about the Rest Api Endpoints... My question is when i have groups of users beside the authentication that will be implemented accordingly , i should have a single users endpoint or different based on the user's role and in the users to have only the shared functionality?

dusty matrixBOT
#

This post has been reserved for your question.

Hey @frigid fiber! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

glass jasper
#

Can you elaborate on that? What endpoints are you talking about exactly?

frigid fiber
#

for example i have the site and they can register users and each user much have a role , soo i have entities as secretary, mechanic , customer that extends the user entity soo my question is should i make different endpoints - controllers for each entity or should access and manage the other entities through the users controller-endpoints? for example to change the mechanics info will be under the url api/mechanics or at api/users?userRole="mechanic"

glass jasper
#

I'd say you should structure your endpoints by operations, not by roles

#

so if the same operation can be performed by users with different roles, create one endpoints and allow multiple roles to use it

frigid fiber
#

soo to have the single controller for endpoints and manage the user auth on service layer not on controller how to access

#

to give permission on the single to all but then and based on access and the filter to do the exact operation with if statements on service soo to not have different endpoints correct?

glass jasper
frigid fiber
#

soo generally its better to keep the resourse only seperatly and all the others that extends or its a part of a resource to be as endpoints with query params etc in their based resource controller?

glass jasper
#

What do you need query params for now?