How to change tags of a story
For this you will need the Graphql id of the story (see How to get a Story).
And you will need to find the Global IDS of tags you want to add.
First let's search for "Global Tags" (not limited to a space) with the name
graphqlquery SearchHashtags {me {searchGlobalTags(text: "a tag") {tag {idname}}searchHashtags(text: "hashtag") {hashtag {idname}}# OR Search tags of a given Facetnode(id: "RmFjZXQ6ImNvZ2l0b192ZWlsbGUi") {... on Facet {idsearchTags(text: "my query") {tag {idname}}}}}}
Expected result:
response{"data": {"me": {"searchGlobalTags": [{"tag": {"id": "VGFnOjEwOQ==","name": "a nice tag"}},{"tag": {"id": "VGFnOjQwMw==","name": "another test tag"}},{"tag": {"id": "VGFnOjI2Nw==","name": "tag in two"}}],"searchHashtags": [{"hashtag": {"id": "SGFzaHRhZzozMDU=","name": "my cool hashtag"}},{"hashtag": {"id": "SGFzaHRhZzo0MTI=","name": "Nouveau hashtag"}}]},"node": {"id": "RmFjZXQ6InRow6htZXMi","searchTags": [{"tag": {"id": "VGFnOjEzOA==","name": "api versioning"}},{"tag": {"id": "VGFnOjE0OQ==","name": "design"}}]}}}
Then Keep on the side the "id" of the tags you want to use.
If you don't find the tag you need, you can create a new tag in the facet:
graphqlmutation CreateANewTag {tagCreate(input: {facetId: "eWVhaCByaWdodCBpdCdzIGI2NA==",names: {en: "Name of the tag"}}) {tag {id}}}
This example demonstrates how to add/remove Tags and Hashtags on a given content.
graphqlmutation storyTagExample($input: StoryTagInput!) {storyTag(input: $input) {story {tags {idname}hashtags {idname}}}}
variables{"input": {"id": "STORY_ID","addedTags": ["TAG_ID_1", "TAG_ID_2"],"removedTags": ["TAG_ID_3"],"addedHashtags": ["HASHTAG_ID_1"],"removedHashtags": []}}
Expected result:
response{"data": {"storyTag": {"story": {"tags": [{ "id": "TAG_ID_1", "name": "Tag 1" },{ "id": "TAG_ID_1", "name": "Tag 2" }],"hashtags": [{ "id": "HASHTAG_ID_1", "name": "Hashtag 1" }]}}}}