Frontend Action Required: API Filter Parameter Standardization¶
Hi Team,¶
To improve the consistency and predictability of our API, we are standardizing all ID-based filters on the /api/coffee-beans endpoint.
The Change: All filters that accept an entity ID will now be plural and accept an array of IDs. This makes the API more flexible and simplifies your query-building logic.
This is a breaking change. The old singular parameters will no longer work.
Old vs. New¶
| Endpoint | Old Parameter | New Parameter |
|---|---|---|
/api/coffee-beans |
roasterId={uuid} |
roasterIds[]={uuid} |
/api/coffee-beans |
countryId={uuid} |
countryIds[]={uuid} |
Action Required¶
You will need to update your frontend code that builds the filter query string.
- Always use
roasterIds[]instead ofroasterId. - Always use
countryIds[]instead ofcountryId.
Even when the user has only selected a single roaster or country, it must be sent as an array.
Example:
// Before
const params = new URLSearchParams();
params.append('roasterId', 'roaster-uuid-123');
// Result: ?roasterId=roaster-uuid-123
// After
const params = new URLSearchParams();
params.append('roasterIds[]', 'roaster-uuid-123');
// Result: ?roasterIds[]=roaster-uuid-123
Benefits for the Frontend¶
- Consistency: You can now use the same logic for all ID-based filters. No more special cases for
roasterorcountry. - Flexibility: This change paves the way for future features that might allow selecting multiple roasters or countries at once.
Please let us know if you have any questions.
Thanks, The Backend Team