Skip to content

[REX-3084] Add getRecommendationPage for the recommendations page endpoint - #274

Draft
TimDumol wants to merge 1 commit into
Constructor-io:masterfrom
TimDumol:rex-3084-page-results
Draft

TimDumol wants to merge 1 commit into
Constructor-io:masterfrom
TimDumol:rex-3084-page-results

Conversation

@TimDumol

Copy link
Copy Markdown

Adds recommendations.getRecommendationPage(pageId, parameters, userParameters, networkParameters) for GET /recommendations/v1/pages/{page_id} (API reference), for server-rendered integrations. A page returns every pod configured on it in one request, deduplicated across pods server-side.

What it does

  • Shared parameters: itemIds, variationId, section, term, numResults, filters, filterMatchTypes, preFilterExpression, fmtOptions, hiddenFields, variationsMap, plus the usual userParameters (session, client, user, segments, origin referrer, user IP/agent headers) and the security token header.

  • podOverrides: { [podId]: { numResults, filters, filterMatchTypes, preFilterExpression, fmtOptions, hiddenFields, variationsMap } } is sent in bracket notation, e.g. pod_overrides[complete_the_look][filters][color]=red. Each value uses the same wire format as the top-level param: pre_filter_expression and variations_map are JSON strings. An override replaces the page-wide value for that pod. Page-wide keys inside an override are rejected client-side.

  • Tracking: per-pod result_id. Each pod's own result_id is stamped onto that pod's results. The top-level result_id identifies the page request and is not a tracking id: send response.pods[].result_id with each pod's recommendation view/click events.

  • Like getRecommendations, the returned promise exposes requestUrl.

  • Types: RecommendationPageParameters, RecommendationPagePodOverride, RecommendationPageResponse, RecommendationPagePod.

  • fmt_options replace semantics: hiddenFields is sent inside fmt_options, and an override replaces the page-wide value wholesale. So an override that sets only hiddenFields drops the page-wide fmtOptions for that pod, and vice versa.

Back-compat

getRecommendations is unchanged. Its user query params and headers now come from shared helpers. I compared URL + headers from origin/master and this branch on the same inputs, and they are identical apart from _dt. No docs/ or version changes.

Testing

  • npm run lint: no errors (1 pre-existing no-console warning in a catalog spec)
  • npm run test:types (tsd): passes, with new page type tests
  • New mocked specs (stubbed fetch, no network): 8 passing. They cover the URL/path, shared + user params and headers, bracket encoding of pod_overrides (array filters, num_results=0, JSON pre_filter_expression/variations_map, fmt_options + hiddenFields), per-pod result_id stamping (page id never used), requestUrl, and the rejections.
  • cspell (**/*.js): clean
  • Live tests are added in describe.skip('getRecommendationPage - live'). The page endpoint is not yet enabled on the test index, and the test index has no page configured (/recommendations/v1/pages/pdp_b2c returns 404).
  • I did not run the existing live suite locally (no test API key); CI will.

Blocked / follow-ups

  • Live tests need the page endpoint enabled on the test index and a page configured there.

🤖 Generated with Claude Code

…point

Calls GET /recommendations/v1/pages/{page_id}. Shared parameters use the
same wire format as getRecommendations; podOverrides are sent as
pod_overrides[<pod_id>][<param>] in bracket notation.

Each pod's own result_id is stamped onto that pod's results. The
top-level result_id identifies the page request and is not a tracking id.

getRecommendations URL and headers are unchanged; the session/user query
parameters and request headers are built by shared helpers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant