User Element and Group Element API

This article describes  user_element and group_element API endpoints, which provide information on elements available to users and group members respectively. These endpoints also allow assigning and revoking access to the elements.

Prerequisites:

Table of contents:

  1. Access Admin > System > API Toolkit
  2. Configure User Elements
    1. Get User Elements
    2. Add Element Access to User
    3. Remove Element Access From User
  3. Configure Group Elements
    1. Get Group Elements
    2. Add Element Access to Group
    3. Remove Element Access From Group 

NOTE: In v7.0.1 and 7.0.1a the returned parameter name formats were changed:

  • user_element: element_id, user_id -> element, user
  • group_element: element_id, group_id -> element, group

In v7.0.2:

  • user_element supports both new and old parameter name formats,
  • group_element: supports only old parameter name format (element_id, group_id).

Beginning v7.0.2, both user_element and group_element APIs support both new and old parameter name formats.

1. Access Admin > System > API Toolkit

2. Configure User Elements

2.1. Get User Elements

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

GET request to user_element returns all elements available to the user.

  1. Item: user_element
  2. Method: GET
  3. Filter the results with the following parameters:
    • ID: The ID of the user_element data entry
    • user: The ID of the user
    • email: The email of the user
    • all: If set to 'Y', additionally returns all elements that the user has indirect access to via groups and categories
  4. Enter an API Token
  5. [Run request]

Example Response

{
  "user_elements": [
    {
      "id": 945,
      "user": 3,
      "element": 688
    },
    {
      "id": 953,
      "user": 3,
      "element": 693
    },
   ]
}

Fields Description

Field Name Value Type Description
id integer The ID of the user_element data entry.
user integer The ID of the user.
element integer The ID of the element.

2.2. Add Element Access to User

POST request to user_element adds element access to the user.

  1. Item: user_element
  2. Method: POST
  3. Enter ID of an existing user_element data entry
  4. Modify the request by providing values
  5. Enter an API Token
  6. [Run request]

2.3. Remove Element Access From User

DELETE request to user_element removes element access from the user.

  1. Item: user_element
  2. Method: DELETE
  3. Enter the ID of user_element data entry that needs to be deleted
  4. Enter an API Token
  5. [Run request]

3. Configure Group Elements

3.1. Get Group Elements

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

GET request to group_element returns all elements available to group members.

  1. Item: group_element
  2. Method: GET
  3. Filter the results with the following parameters:
    • ID: The ID of the group_element data entry
    • group: The ID of the group
    • all: If set to 'Y', returns all elements that the group members have indirect access to via categories
  4. Enter an API Token
  5. [Run request]

Example Response

{
  "group_elements": [
    {
      "id": 20,
      "group": 9,
      "element": 10
    },
    {
      "id": 21,
      "group": 9,
      "element": 97
    }
  ]
}

Fields Description

Field Name Value Type Description
id integer The ID of the group_element data entry.
group integer The ID of the group.
element integer The ID of the element.

3.2. Add Element Access to Group

POST request to group_element adds element access to group members.

  1. Item: group_element
  2. Method: POST
  3. Enter ID of an existing group_element data entry
  4. Modify the request by providing values
  5. Enter an API Token
  6. [Run request]

3.3. Remove Element Access From Group

DELETE request to group_element removes element access from group members.

  1. Item: group_element
  2. Method: DELETE
  3. Enter the ID of group_element data entry that needs to be deleted
  4. Enter an API Token
  5. [Run request]