You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: I do not pass isShared flag here since the endpoint itself indicates that projects are shared by me meaning isShared will be always true in that case.
Question
What according to best practices should the response be like? Should I include the isShared property in /v1/projects/shared-by-me or it's ok to not include that?
Client Side Implementation
Assume client-side has a common react component that renders the details based on this response. so If I don't pass isShared it is recommended for the Client-side to add it manually and add conditional rendering?
I would try to keep the ‘projects’ resource representation consistent (i.e., with ‘isShared’) and not impose any additional requirements on a client to understand that additional properties are needed and that they must be defaulted to some value if missing. I would also change the URLs (/projects/all and /projects/shared-by-me) to use a query parameter instead (e.g., /projects?filter=all and /projects?filter=shared-by-me). The current URLs depict two separate nested resources (‘all’ and ‘shared-by-me’) under a ‘projects’ resource, and I believe you instead want a single resource and simply need to query it differently. Anyway, hope this helps, good luck.
Activity
chasdev commentedon Mar 15, 2021
I would try to keep the ‘projects’ resource representation consistent (i.e., with ‘isShared’) and not impose any additional requirements on a client to understand that additional properties are needed and that they must be defaulted to some value if missing. I would also change the URLs (/projects/all and /projects/shared-by-me) to use a query parameter instead (e.g., /projects?filter=all and /projects?filter=shared-by-me). The current URLs depict two separate nested resources (‘all’ and ‘shared-by-me’) under a ‘projects’ resource, and I believe you instead want a single resource and simply need to query it differently. Anyway, hope this helps, good luck.