Developer forum

Forum » Development » Products search api issues

Products search api issues

Karol Barkowski
Reply

Hi,

I have a sample project (9.17.6) where I've installed most recent Swift. I've created a product repository, index and two sample queries.
Now, if I'll pick up those queries as ones used by the Product Catalog App, it looks like it works fine. I see my products and whatever changes I make to the queries, they are reflected on my product list. Also facets work just fine. I can filter my list, see selected facets, ect.
But, if I'm trying to use the same queries with api calls, like for example by calling this url:

https://localhost:44374/dwapi/ecommerce/products/search?RepositoryName=SwiftProducts&QueryName=Products&PageSize=10&CurrentPage=1

It either returns 404 with a message saying that there are no products found or, in case of the second query, I get a response with a list of products but the "FacetGroups" property remains empty:

{
    "Products": [ ... this is filled... ],
    "PageSize": 1,
    "PageCount": 5943,
    "CurrentPage": 1,
    "TotalProductsCount": 5943,
    "FacetGroups": [ ...this remains empty...]
}

What am I missing here? I tried reindexing like crazy and restarting the app a dozen of times . Why the same queries work when handled server side but behave differently when called from the client via api?


Replies

 
Justin Sjouw Dynamicweb Employee
Justin Sjouw
Reply

Hi Karol,

Are You using the standard Swift queries? In these there are a bunch of parameters that are tied to the website context (i.e. a running instance of Swift) that will not be filled when running through the API without the Swift context. Just an an initial guess though :-)

If you are using the standard queries, it is probably a good idea to create a new Query specifically for API usage.

 

You must be logged in to post in the forum