Category User and Category Group API

This article describes the endpoints available for configuring Category access for Users and Groups.

  • /api/category_user: Retrieve, assign, remove Category access from a User.
  • /api/category_group: Retrieve, assign, remove Category access from a Group.

NOTE: Both endpoints are available for Metric Insights v7.0.2+.

Prerequisites:

Table of contents:

  1. Access Admin > System > API Toolkit
  2. Configure User Categories
    1. Get User Categories
    2. Add Category Access to User
    3. Delete Category Access from User
  3. Configure Group Categories
    1. Get Group Categories
    2. Add Category Access to Group
    3. Delete Category Access from Group 

1. Access Admin > System > API Toolkit

2. Configure User Categories

2.1. Get User Categories

NOTE: The id of each category_user data entry is unique and can be used to create new data entries or delete the existing ones.

  • GET request to /api/category_user returns all User-to-Category access mappings.
  • GET request to /api/category_user/id/<ID> returns the selected User-to-Category access mapping.
  1. Item: category_user
  2. Method: GET
  3. Filter the results with the following parameters:
    • ID: The ID of the category_user access mapping.
    • category_id: The ID of the category
    • user_id: The ID of the user
  4. Enter an API Token
  5. [Run request]

Example Response

{
  "category_users": [
    {
      "id": 76,
      "category_id": 111,
      "user_id": 100,
      "allow_edit_element": "No"
    },
    {
      "id": 77,
      "category_id": 123,
      "user_id": 66,
      "allow_edit_element": "No"
    }
  ]
}

Fields Description

Field NameValue TypeDescription
category_usersarrayArray containing all User-to-Category access mappings.
idintegerThe ID of the category_users data entry.
category_idintegerThe ID of the Category.
user_idintegerThe ID of the User.
allow_edit_elementstringWhether the User has edit access to the Elements in the Category.
  • Supported values: "Yes"/"No"

2.2. Add Category Access to User

  • POST request to /api/category_user assigns Category access to a User.
  1. Item: category_user
  2. Method: POST
  3. Enter the ID of an existing category_user data entry
  4. Modify the request by providing parameter values
  5. Enter an API Token
  6. [Run request]

2.3. Delete Category Access from User

  • DELETE request to /api/category_user removes Category access from a User.
  1. Item: category_user
  2. Method: DELETE
  3. Enter the ID of category_user data entry that needs to be deleted
  4. Enter an API Token
  5. [Run request]

3. Configure Group Categories

3.1. Get Group Categories

NOTE: The id of each category_group data entry is unique and can be used to create new data entries or delete the existing ones.

  • GET request to /api/category_group returns all Group-to-Category access mappings.
  • GET request to /api/category_group/id/<ID> returns the selected Group-to-Category access mapping.
  1. Item: category_group
  2. Method: GET
  3. Filter the results with the following parameters:
    • ID: The ID of the category_group data entry
    • category_id: The ID of the category
    • group_id: The ID of the group
  4. Enter an API Token
  5. [Run request]

Example Response

{
  "category_groups": [
    {
      "id": 3,
      "category_id": 58,
      "group_id": 2,
      "allow_edit_element": "No"
    },
    {
      "id": 4,
      "category_id": 59,
      "group_id": 2,
      "allow_edit_element": "No"
    }
  ]
}

Fields Description

Field NameValue TypeDescription
category_groupsarrayArray containing all Group-to-Category access mappings.
idintegerThe ID of the category_groups data entry.
category_idintegerThe ID of the Category.
group_idintegerThe ID of the Group.
allow_edit_elementstringWhether the Group members have edit access to the Elements in the Category.
  • Supported values: "Yes"/"No"

3.2. Add Category Access to Group

  • POST request to /api/category_group assigns Category access to Group members.
  1. Item: group_category
  2. Method: POST
  3. Enter ID of an existing category_group data entry
  4. Modify the request by providing values
  5. Enter an API Token
  6. [Run request]

3.3. Delete Category Access from Group

  • DELETE request to /api/category_group removes Category access from Group members.
  1. Item: category_group
  2. Method: DELETE
  3. Enter the ID of category_group data entry that needs to be deleted
  4. Enter an API Token
  5. [Run request]