Skip to main content

Notifications

Announcements

No record found.

Supply chain | Supply Chain Management, Commerce
Unanswered

How to refine search products using the retail server API in eCommerce?

Posted on by 60

Hello experts!

We're trying to understand the Retail Server API a little better and as a small exercise, we're trying to get all products of a certain category under a certain price.

We were able to get the products belonging to a specific category by using searchByCategoryAsync, but we think it is naive to get All products from a category and do the filtering on the device.

So we tried to find a function that allows us to send filter parameters and have the server answer with the already-filtered information

Currently we think that refineSearchByCategoryAsync is exactly what we're looking for, but we get errors saying that we're not calling the API correctly.

We don't understand the interface - ProductRefinerValue extends SearchRefinerValue that is suggested to us by the IDE, and we tried all kinds of parameter combinations. Does anyone here know how to properly send filter requests to the server?

Here's the interface:

export interface ProductRefinerValue extends SearchRefinerValue { RefinerSourceValue?: number; SwatchImageUrl?: string; SwatchColorHexCode?: string; }

export interface SearchRefinerValue { RefinerRecordId?: number; DataTypeValue?: number; LeftValueBoundString?: string; RightValueBoundString?: string; UnitText?: string; RowNumber?: number; Count?: number; LeftValueBoundLocalizedString?: string; RightValueBoundLocalizedString?: string; ExtensionProperties?: CommerceProperty[]; }

And here's what we're trying right now:

refineSearchByCategoryAsync( { callerContext: this.props.context.actionContext }, this.props.context.request.apiSettings.channelId, this.props.context.request.apiSettings.catalogId, _categoryId,

[

{ // refiner goes here }           

 ])

.then(res => { console.log('refineSearchByCategoryAsync'); res.forEach(product => { console.log(JSON.stringify(product, null, 2)); }); }) .catch(e => console.error('error', e));

  • Ramune Profile Picture
    Ramune on at
    RE: How to refine search products using the retail server API in eCommerce?

    Hi Cesar,

    As this question is related to the extension, I will leave it for the community to answer. Let's see if anybody has experienced the same and can advise for you anything.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans