User and Group API

This article provides sample API calls to add Users and Groups and access to Dimensions.

PRE-REQUISITES:

1. Fetch Users

You can fetch the list of all users created in the system.

  1. Item: user
  2. Method: GET
  3. Request URL (generated automatically):
 https://docs.metricinsights.com/api/user
  1. Run Request

1.1. Create User

This call creates a new user. After this user is created, Login credentials are going to be sent to a specified email address.

  1. Item: user
  2. Method: POST
  3. ID: Specify ID of any other user previously created in the system. This user's data is going to serve as a basis for creating a new user. User ID can be found at the User Editor link (Admin > Users > select a user):
https://docs.metricinsights.com/admin/user/edit/id/4
  1. Define the following required user info:
    • username, first_name, last_name, email, password
    • type: regular, power or administrator

Optional:

  • copy_from_user_id: Specify ID of a user you want to copy all permissions from.
  • in_group_id: If this value is not specified, the created user is going to be assigned to a default User Group. If you want to assign a new user to a specific Group instead of a Default group (for example, to the "Finance" group), specify ID of the required Group in this field. Group ID can be found at the Group Editor link (Admin > Groups > select a group):
https://docs.metricinsights.com/admin/group/edit/id/2
  1. Run Request

2. Fetch Groups

You can fetch the list of all users created in the system.

  1. Item: user_group
  2. Method: GET
  3. Request URL (generated automatically):
 https://docs.metricinsights.com/api/user
  1. Run Request

2.1. Create Group

This call creates a new User Group.

  1. Item: user_group
  2. Method: POST
  3. ID: Specify ID of any other User Group previously created in the system. This Group's data is going to serve as a basis for creating a new Group. Group ID can be found at the Group Editor link (Admin > Groups > select a group):
https://docs.metricinsights.com/admin/group/edit/id/2
  1. Provide a meaningful Group name
  2. all_access_group: Specify "yes" / "no". If creating an All Access Group, its members inherit access to all available elements, Dimensions, Dimension Values, Categories and Datasets
  3. Optionally, enter a description for the Group
  4. Run Request

3. Review User's Group membership

You can get a list of all Groups a certain User is a member of.

  1. Item: user_group_member
  2. Method: GET
  3. user: Specify ID of a User you want to make a member of a specific Group. User ID can be found at the User Editor link (Admin > Users > select a user):
https://docs.metricinsights.com/admin/user/edit/id/170
  1. Run Request

NOTE: In this example User belongs to several groups.

3.1. Add User to Group

This procedure allows adding a user to a specified group (one user at a time).

  1. Item: user_group_member
  2. Method: POST
  3. ID: Enter the ID of the previously created "user+group" combination. To see the list of all such pairs, choose GET method, leave other fields and Run Request. All "user+group" combinations are going to be displayed in the Raw response field. Choose the one that is supposed to serve as a foundation for the new combination.
  4. user_id: Specify ID of a User you want to make a member of a specific Group. User ID can be found at the User Editor link (Admin > Users > select a user):
https://docs.metricinsights.com/admin/user/edit/id/360
  1. user_group_id: Specify ID of the User Group you want this User to be assigned to. Group ID can be found at the Group Editor link (Admin > Groups > select a user):
https://docs.metricinsights.com/admin/group/edit/id/3
  1. Run Request

3.2. Remove User from the Group

To remove a user from a group, first fetch the Groups that the user is a member of (see Step 3)

  1. Item: user_group_member
  2. Method: DELETE
  3. ID: Enter the ID of the previously created "user+group" combination. To fetch all Groups that the User is a member of, see Step 3 of this article
  4. Run Request

4. Add Dimension access to Group (to all Dimension Values)

This procedure allows adding a user to a specified group (one user at a time).

  1. Item: group_dimension
  2. Method: POST
  3. ID: Enter the ID of the previously created "group+dimension" combination. To see the list of all such pairs, choose GET method, leave other fields empty and Run Request. All "group+dimensioned" combinations are going to be displayed in the Raw response field. Choose the one that is supposed to serve as a foundation for the new combination. If you want to give all users of a specific group access to all Dimension values, it is better to choose a combination with "All Dimension Access".
  4. dimension: Specify ID of a Dimension you want to give access to. Dimension ID can be found at the Dimension Editor link (Content > Dimensions > select a Dimension):
https://docs.metricinsights.com/editor/segment/edit/segment/60
  1. scope_of_access: All Dimension values
  2. group: Specify ID of the Group to which access should be given. Group ID can be found at the Group Editor link (Admin > Groups > select a group):
https://docs.metricinsights.com/admin/group/edit/id/33
  1. Run Request

4.1. Add specific Dimension Value access to Group

API:

https://yourinstance.metricinsights.com/api/group_dimension_value

Header:

Accept:application/json
Token:UClCUUKxUlkdbhE1cHLz3kyjbIZYVh9eB34A5Q21Y3FPqKGSJs

POST body payload:

{
"group": "14",
"dimension": "55",
"dimension_value": "7094"
}

Response:

{"id":"2","dimension_value":"7094","dimension":"55","group":"14"}

0 Comments

Add your comment

E-Mail me when someone replies to this comment