XRecommend Service

Prev Next

Methods

// Returns a recommendation response mapped by element IDs.

xg.recommend.getResults({elementIds: ['<element_id_1>', '<element_id_2>']})

// Returns a recommendation response for the given element ID.

xg.recommend.getResultsById({elementId: '<element_id>'});

getResults

getResults

Description: Gets recommendation results by a list of elementIds.

Parameters

Name

Type

Required

Description

elementIds

string[]

The IDs of the elements

context

object

Dynamic context object

queryId

string

An optional queryId passed to cancel a request

Returns

A Promise resolving to a Recommendations object:

{

  [key: string]: {

    items: RecommendProduct[];

    ruleEngine: string;

    ruleset: string;

  };

}

getResultsById

getResultsById

Description: Gets recommendation results by a single elementId.

Parameters

Name

Type

Required

Description

elementId

string

The ID of the element

context

object

Dynamic context object

queryId

string

An optional queryId passed to cancel a request

Returns

A Promise resolving to a Recommendations object:

{

  items: RecommendProduct[];

  ruleset: string;

  ruleEngine: string;

}