Get or Create

Get or Create User Group

POST https://api.explo.co/embed/create_user_group/

This endpoint gets or creates a new user group. If the user_group_id does not exist, a new user group will be created and information about the group will be sent back. If the user_group_id exists, no action will be taken but the same information about the group will be sent back. There will be a flag in the response indicating if a new user group was created.

Headers

Name
Type
Description

Explo-Authorization

string

API authorization token which is unique to your team. You can access this in the Developers tab in your account.

Request Body

Name
Type
Description

name

string

This is the name of the user group.

user_group_id

string

This is the ID you use to identify this user group in your database.

mapping

JSON

This is a JSON mapping of schema id to either the data source that this user group should be associated with or id of the datasource you provided when creating it.

properties

JSON

This is a JSON object for properties assigned to this user group. These will be accessible through variables in the dashboards and SQL editor

{
    "success": 1,
    "new_user_group": true,
    "user_group": {
        "team_id": 3,
        "token": "<user_group_token_to_auth_dashboard>",
        "name": "Example 1",
        "provided_id": "example_1",
    }

Response field descriptions

Field Name

Type

Description

success

number

Indicates whether the call was successful. 1 if successful, 0 if not.

new_user_group

boolean

Indicates whether a new user group was created.

user_group.team_id

number

This is Explo's internal ID for this user group. You don't need to record this information, since you will not need to use it.

user_group.token

string

This is the user group token (userGroupToken or USER_GROUP_TOKEN) that will be used to identify which user group is viewing the dashboard. You should save this on your end to use when rendering an embedded dashboard.

user_group.name

string

This is the name of the user group provided in the request body.

user_group.provided_id

string

This is the user_group_id provided in the request body.

user_group.properties

JSON | Null

This is the properties object if it was provided in the request body

user_group.api_environment_tag

string

This is the environment tag of the user group. Possible values are 'Customer' and 'Testing'

User group id's must be unique to each environment, so you can not create multiple user groups with with same id. If you have a production customer and a test user group with the same id, you will be required to label one as 'Customer' and another as 'Testing'

Example Request

curl --location --request POST 'https://embeddo.herokuapp.com/embed/create_user_group/' \
--header 'Content-Type: application/json' \
--header 'Explo-Authorization: Token <token>' \
--data-raw '{
    "user_group_id": "example_1",
    "name": "Example 1",
    "mapping": {"40": "213", "134": "386"},
    "properties": {"filterValue": "value"}
}'

Last updated

Was this helpful?