Skip to content

[FEAT]: Add Filter to GET Request for Product Endpoint #1067

@PeterOyelegbin

Description

@PeterOyelegbin

Is your feature request related to a problem? Please describe.
Currently, the product endpoint GET /api/products retrieves all products without any filtering options. This becomes problematic when users need to fetch specific products based on criteria such as category. For example, a user might want to retrieve only products in a particular category. Without filtering, the client has to retrieve and manually filter all products, which is inefficient and increases unnecessary data transfer.


Describe the solution you'd like
I propose adding query parameters to the GET /api/products endpoint to allow filtering based on category (e.g., ?category=CATEGORY_NAME).
Example request:

GET /api/products?category=CATEGORY_NAME

This would return only products in that particular category


Additional context

  • This feature would align with RESTful API best practices, where query parameters are commonly used for filtering, sorting, and pagination.
  • The implementation should ensure backward compatibility so that existing clients using the endpoint without filters continue to work as expected.
  • Documentation should be updated to include examples of how to use the new filtering options.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions