Tag API Call

paul carter asked on November 13, 2019 12:08

Hi, Just wanted to confirm my understanding of Tags and Tag Groups. I am currently writing an API call to update tags on a number of document pages. My understanding is that there is a distinct relationship between the tags which must belong to a tag group, so my question is. for each tag i associate with a page i also have to assign the page to a tag group. Secondly i note on some pages they inherit the tag group, but no tags have been specified in the tag field. Does this mean all or no tags from the group are applied. I am assuming none ?

Recent Answers


Peter Mogilnitski answered on November 13, 2019 18:10

I guess the best way understand is to see what is happening at the DB level, you have 2 fields responsible for the tags DocumentTags and DocumentTagGroupID at the cms_document:

select DocumentTags, DocumentTagGroupID, * from view_cms_tree_joined where documentid = 123

if DocumentTagGroupID is Null - it is inherited form the parent document. Page can have only one tag group, on top of that switching tag group doesn't affect DocumentTags field. Technically tag group exist only for organization purposes, it helps you to select tags, but doesn't restrict them: You can assign tags from one group to a document then switch group and assign tags from a different group (in the admin interface). So at the end you get the tags from both groups assigned to your document, but document can have only one tag group. Switching tag group does not automatically remove the tags that do not belong to the new tag group.

Secondly you can create a brand new tag by entering it and will automatically get assigned to current document tag group. if it is null - it it will be assigned parent tag group. In the DB yo have 3 tables responsible for tags:

select * from CMS_Tag -- tag definition
select * from CMS_TagGroup -- tag group definition
select DocumentID, TagID from CMS_DocumentTag -- the assignment table

Please not that CMS_DocumentTag doesnt has no info about the tag group.

That being said, each tag must be assigned to a tag group. Whether tag group is assigned to a page or not (i.e inherited) - doesn't matter. What important is the tags assigned to the page, not the tag groups. If there is not tags assigned - it means not tags assigned.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.