RealDevSquad / RealDevSquad/website-backend

[ RFC ] API Endpoint Design for Filtering a specific Document by specific fields

Open
#1,105 3 comments 0 reactions 1 assignee View on GitHub

@heyrandhirs is already working on this.

Since May 21, 2023.

Dominant language
JavaScript
Stars
74
Forks
276
Avg merge
1d 26m
Merged PRs (30d)
14

Description

Abstract

This RFC aims to discuss the appropriate API endpoint design for filtering progresses based on user and date parameters in a RESTful API. The goal is to determine the most suitable approach for providing filtering capabilities while adhering to RESTful principles and maintaining API consistency.

When implementing an API endpoint to retrieve a specific document from the collection based on the specific user and a specified date criteria, For a particular user and a particular date we will have a unique document.

two common approaches are often considered:

Using Path Parameters:

/progresses/user/XGqmn2yJoneT1aXXh22P/date/2023-05-21

Using Query Parameters:

/progresses?userId=XGqmn2yJoneT1aXXh22P&date=2023-05-21

This RFC aims to discuss the advantages and considerations of each approach to determine the most RESTful and effective solution.

Path Parameters
Using path parameters in the API endpoint structure can provide a more hierarchical and resource-oriented design. It is commonly used when the values are considered mandatory and represent essential parts of the resource identification. However, it's important to note that path parameters are not typically used for filtering data, but rather for specifying specific resource identifiers.

Query Parameters
Using query parameters offers a more flexible and concise approach to provide filtering capabilities. Query parameters are commonly used when the values are optional and used for filtering and pagination. Query parameters allow for a clear separation between the base endpoint and the filtering parameters, making the API more intuitive for API consumers.

We kindly request that you review the attached API design proposal and share your comments, suggestions, and concerns . Your feedback will enable us to refine the API design and ensure its effectiveness and usability.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.