[]
        
(Showing Draft Content)

Manage Categories

This article talks about managing document categories (or tags) using GraphQL.

Get the list of categories

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          
    }
  }

Get details of all categories

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:

Attributes Description
id Gets the category ID or tag ID
parentId Gets the ID of the parent category in case the specified category is its sub category. The result is null if the category does not have a parent category.
name Gets the name of the category
url Gets the URL name of the category
documents Obtains details on the resources available under a category. See this topic on the attributes available in documents object.
order Gets the order of the category
iconCssClass Gets the name of the icon css class.
color Gets the color of the icon.
isFavorites Gets the information on whether the category is Favorites

Add a new category

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:

Attributes Description
name Name of the new category
urlName URL name of the category
order Order of the category
iconCssClass Name of the iconCssclass. You can choose from following:
'mdi mdi-folder', 'mdi mdi-account', 'mdi mdi-account-multiple', 'mdi mdi-lock-outline',
'mdi mdi-lock-open-outline', 'mdi mdi-credit-card', 'mdi mdi-currency-usd',
'mdi mdi-currency-eur', 'mdi mdi-currency-jpy', 'mdi mdi-comment-text-outline',
'mdi mdi-chart-bar', 'mdi mdi-calculator', 'mdi mdi-book', 'mdi mdi-briefcase',
'mdi mdi-cloud-outline', 'mdi mdi-bank', 'mdi mdi-city', 'mdi mdi-clippy',
'mdi mdi-thumb-up-outline', 'mdi mdi-comment-check-outline', 'mdi mdi-trending-up',
'mdi mdi-trending-down', 'mdi mdi-trophy-variant-outline', 'mdi mdi-chart-areaspline'
color Color of the icon. You can specify color by name or by a hex color code such as #F44336, #abb50d, #607D8B, etc.
parentId ID of the parent category in case the specified category is its sub category. The result is null if the category does not have a parent category.
id Returns the ID of the new category

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
    }
  }

Update a category

Use the following mutation to update a category:

mutation 
  { 
    updateTag(
      id: "tagid",
      name:"<name>",
      urlName:"<urlName>",
      order: <order>,
      color: "<color>"){
      id
    }
  }

Delete a category

Use the following mutation to delete a category:

 mutation 
  {
    deleteTag(id: "tagid")
    {
      deleted_ids
    }
  }