Developer forum

Forum » Ecommerce - Standard features » Get top level groups from WebApi

Get top level groups from WebApi

Martin Moen
Reply

How can I get only the top level groups from the web api?

​/dwapi​/ecommerce​/groups has a parameter for ParentId, but leaving that blank will only result in getting all the groups, not only the groups with no parents.

So how can I get only the top level groups from the web api?


Replies

 
Nicolai Pedersen
Reply

Hi Martin

You can use the Shopid parameter instead and leave parentid blank:

 
Martin Moen
Reply

What version are you running?
I'm trying this on 9.13.9 and it is not working. Also I do not see those handy descriptions you have on your screen :)

 
Nicolai Pedersen
Reply

The descriptions are just an update of the comments - they were added in november 2021 which is the last change to this controller. So if you do not see those descriptions, you might have an older webapi dll?

Also make sure to use the correct of these - the first one. The second endpoint does also take shopid as parameter but is never used (same thing for parentid), so that is a mistake.

 

 
Mikkel Belchuke
Mikkel Belchuke
Reply

Any news on this? This still does not seem to give me the top level groups. I'm using the latest webapi dll.

 

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply
This post has been marked as an answer

Hi Mikkel,

I think this could be an issue with imported data in the swift database. It seems that all groups have somehow been created as top level groups.

You can try to fix that by executing the following sql statement:

DELETE FROM EcomShopGroupRelation WHERE EXISTS(SELECT 1 FROM EcomGroupRelations WHERE GroupRelationsGroupId = ShopGroupGroupId)

That will remove any direct relation between a shop and a group (top level) for all groups which has a parent group (not top level).

Then recycle the application pool in IIS to clear all caches.

Does that solve the issue?

/Morten

Votes for this answer: 1
 
Mikkel Belchuke
Mikkel Belchuke
Reply

Hi Morten.

Yes, this fixes the issue. Is this something you will fix in the next database release? :) 

 
Morten Bengtson Dynamicweb Employee
Morten Bengtson
Reply

Hi Mikkel,

Thanks for confirming.
It has been registered as bug #12859

/Morten

 

You must be logged in to post in the forum