This article talks about managing document categories (or tags) using GraphQL.
Use the following query to get the list of all categories available in the Wyn Portal along with their ID and name:
query { tags { id name } }
Along with the category ID and name, you can also obtain more details using additional attributes available in the API. The following table elaborates the attributes available in tags object in the previous query:
Use the following mutation to add a new category:
mutation { addTag( name:"<tagName>", urlName:"<urlName>", order:<order>, color:"<color>", iconCssClass:"<iconCssClass>", parentId:"<parentId>", ) { id } }
The following table elaborates the attributes available in addTag object in the previous mutation:
Example
The following mutation adds a category named "Banking" on sequence 3, of color #D500F9, with a bank icon, under an existing category with its ID (that is, parentId) specified.
mutation { addTag( name:"Banking", urlName:"Banking", order:3, color:"#D500F9", iconCssClass:"mdi mdi-bank", parentId:"5e2e864a55e9b6008109xxxx") { id } }
Use the following mutation to update a category:
mutation { updateTag( id: "tagid", name:"<name>", urlName:"<urlName>", order: <order>, color: "<color>"){ id } }
Use the following mutation to delete a category:
mutation { deleteTag(id: "tagid") { deleted_ids } }