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
feat: add projection support to suggestions API [SITES-39183] (#1693)
## Summary
Adds field projection via a `view` query parameter and optional status
filtering to the Suggestions API endpoints. This allows clients to
request lighter payloads optimized for specific UI needs (e.g.,
selection lists, table displays).
Implements API projection for suggestions with a schema-driven
architecture.
This PR integrates with spacecat-shared PR-1289 which provides
type-specific data schemas, validation, and projection logic.
adobe/spacecat-shared#1289
## Changes
### `view` parameter
Pre-defined projections for all GET suggestion endpoints:
| View | Returns | Use Case |
|------|---------|----------|
| `minimal` | `id`, `status`, URL-related `data` fields | Lightest
payload for selection lists |
| `summary` | Minimal + `opportunityId`, `type`, `rank`, `url`,
timestamps | Table displays without heavy data |
| `full` | All fields including `data` and `kpiDeltas` | Default,
backward compatible |
### `status` parameter
Filter suggestions by status (non-paginated endpoint only):
- Single status: `?status=NEW`
- Multiple statuses: `?status=NEW,APPROVED,IN_PROGRESS`
- Valid values: `NEW`, `APPROVED`, `SKIPPED`, `FIXED`, `ERROR`,
`IN_PROGRESS`, `OUTDATED`, `PENDING_VALIDATION`
- Returns `400 Bad Request` for invalid status values
> **Note:** Status filtering excluded from paginated endpoints to avoid
pagination inconsistencies. Use `/by-status/{status}/paged` for
paginated status-filtered results.
## Example Usage
### Minimal view for selection list
GET /sites/{siteId}/opportunities/{opptyId}/suggestions?view=minimal
### Summary view with status filter
GET
/sites/{siteId}/opportunities/{opptyId}/suggestions?view=summary&status=NEW,FIXED
### Full view (default)
GET /sites/{siteId}/opportunities/{opptyId}/suggestions
---------
Co-authored-by: Kanishka <kanishka@adobe.com>
- Returns 400 Bad Request for invalid status values
217
+
218
+
**Note:** For paginated results, use the `/paged` endpoints. Status filtering is only available on this non-paginated endpoint or the dedicated `/by-status` endpoints.
0 commit comments