Skip to main content

Get a list of all tag groups, or provide options to find tag groups with a simple query

Call signatures

TypeScript
list(): Promise<PagedList<TagGroup>>;

list({
	language?: string;
	order?: string[];
	pageOptions?: PageOptions;
	q?: string;
}: TagGroupListOptions): Promise<PagedList<TagGroup>>;

Parameters

NameTypeDescription
optionsTagGroupListOptionsAn options object to find tag groups with a simple query, provide paging options or order results by specific fields

Returns

A Promise that will resolve with a PagedList of TagGroup

Remarks

Throws any error that is returned by the API for any unsuccessful request echoing the HTTP status returned from the API

Examples

Get a list of all tag groups (with the pageSize set in the client config)

TypeScript
const tagGroups = await client.tags.groups.list();

console.log(`Found ${tagGroups.totalCount} tag groups`);

for (const tagGroup of tagGroups.items) {
    console.log(`${tagGroup.name} has ${tagGroup.tagCount} tags`);
}

Get a list of tag groups, filtered by a query in a specific language, results to be ordered by name, then by modified date descending, requesting the second page while returning (up to) 10 tag groups in each page

TypeScript
const tagGroups = await client.tags.groups.list({
    q: "topics",
    language: "en-GB",
    pageOptions: {
        pageSize: 10,
        pageIndex: 1
    },
    order: ["name", "-version.modifed"]
});

console.log(`Page ${tagGroups.pageIndex + 1} of ${tagGroups.pageCount}`);

for (const tagGroup of tagGroups.items) {
    console.log(`${tagGroup.name} has ${tagGroup.tagCount} tags`);
}

Still need help?

If you still need help after reading this article, don't hesitate to reach out to the Contensis community on Slack or raise a support ticket to get help from our team.
New support request