API URI structure #1
michael-pisman
started this conversation in
Polls
Replies: 1 comment
-
|
The API will support multiple versions, the version Related Issues: csed-ucm/psephos#79, csed-ucm/psephos#80, csed-ucm/psephos#82 |
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
Uh oh!
There was an error while loading. Please reload this page.
-
Which structure should be used for the API endpoints: hierarchical vs flat.
Both are commonly used. This is in regard to API endpoints and not the front-end client(a Website) URL structure, so SEO, search engine crawlers, etc are not considered. The main focus is to provide a better(more intuitive) structure for front-end developers.
The current layout can be found at https://unipoll-api.1cl.cc/docs
Hierarchical structure:
Tree like structure that defines resource path by their location.
GET /workspacesreturn the list of all workspacesGET /workspaces/{id}return the workspace with specified ID (including groups, members, polls, etc)GET /workspaces/{id}/membersreturn the list of members from the workspace with specified IDGET /workspaces/{id}/groupsreturn the list of groups from the workspace with specified IDGET /workspaces/{id}/groups/{id}return the group (including members, policies, etc) with specified IDGET /workspaces/{id}/groups/{id}/membersreturn the list of members from the group with specified IDPros
Cons
Flat Structure:
GET /workspacesreturn the list of all workspacesGET /workspaces/{id}return the workspace with specified ID (including groups, members, polls, etc)GET /members?workspace={id}return the list of members from the workspace with specified IDGET /groups?workspace={id}return the list of groups from the workspace with specified IDGET /groups/{id}return the group (including members, policies, etc) with specified IDGET /members?group={id}return the list of members from the group with specified IDPros
Cons
Hybrid structure:
Current structure, which combines both options and is neither intuitive or correct use of URI.
GET /workspaces- return the list of all workspacesGET /workspaces/{id}return the workspace with specified ID (including groups, members, polls, etc)GET /workspaces/{id}/membersreturn the list of members from the workspace with specified IDGET /workspaces/{id}/groupsreturn the list of groups from the workspace with specified IDGET /groups/{id}return the group (including members, policies, etc) with specified IDGET /groups/{id}/membersreturn the list of members from the group with specified IDFeel free to suggest other advantages/disadvantages of either method.
1 vote ·
Beta Was this translation helpful? Give feedback.
All reactions