Forum Discussion
Anonymous
7 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.
- Kelemvor7 months agoExpert
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.
- Anonymous7 months ago
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])}")
- Anonymous7 months ago
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
- 2 years ago
- 2 months ago