Forum Discussion
Stuart_Weenig
Mastermind
4 months agoThis should be getting better soon as websites are slated to be moved to the resources page "soon" and would be treated like any other object there.
As for getting the list under a group, you just need the group id then make a call to the api to get the list. Use the SDK and lmwrapper for this.
websites = lm.get_website_list(size=1000, filter="groupId:74").items
Where 74 is the id of the group in question.
- Kelemvor4 months ago
Expert
That only works for the immediate group. I need subgroups included as well. Since websites don't contain the FullPath field like resources do, I don't think there is any way to do this.
- Stuart_Weenig4 months ago
Mastermind
Yeah, you'd just have to loop through all groups:
website_groups = lm.get_website_group_list(size=1000).items for group in website_groups: websites = lm.get_website_list(size=1000, filter=f"groupId:{group.id}").items print(f"{group.full_path}: {','.join([x.name for x in websites])}")
- Stuart_Weenig4 months ago
Mastermind
One liner if you play code golf:
for group in lm.get_website_group_list(size=1000).items: print(f"{group.full_path}: {','.join([x.name for x in lm.get_website_list(size=1000, filter=f'groupId:{group.id}').items])}")
Related Content
- 12 months ago
- 12 months ago
- 3 months ago