|
| 1 | +--- |
| 2 | +title: "Get User" |
| 3 | +api: "GET https://api.mintlify.com/api/user" |
| 4 | +description: "This endpoint gets or creates a new user." |
| 5 | +--- |
| 6 | + |
| 7 | +### Body |
| 8 | + |
| 9 | +<ParamField body="name" type="string"> |
| 10 | + This is the name of the user group. |
| 11 | +</ParamField> |
| 12 | + |
| 13 | +<ParamField body="user_group_id" type="string"> |
| 14 | + This is the ID you use to identify this user group in your database. |
| 15 | +</ParamField> |
| 16 | + |
| 17 | +<ParamField body="mapping" type="object"> |
| 18 | + This is a JSON mapping of schema id to either the data source that this user group should be |
| 19 | + associated with or id of the datasource you provided when creating it. |
| 20 | +</ParamField> |
| 21 | + |
| 22 | +<ParamField body="properties" type="object"> |
| 23 | + This is a JSON object for properties assigned to this user group. These will be accessible through |
| 24 | + variables in the dashboards and SQL editor |
| 25 | +</ParamField> |
| 26 | + |
| 27 | +### Response |
| 28 | + |
| 29 | +<ResponseField name="success" type="number"> |
| 30 | + Indicates whether the call was successful. 1 if successful, 0 if not. |
| 31 | +</ResponseField> |
| 32 | + |
| 33 | +<ResponseField name="new_user_group" type="boolean"> |
| 34 | + Indicates whether a new user group was created. |
| 35 | +</ResponseField> |
| 36 | + |
| 37 | +<ResponseField name="user_group" type="object"> |
| 38 | + |
| 39 | +The contents of the user group |
| 40 | + |
| 41 | +<Expandable title="Toggle object"> |
| 42 | + |
| 43 | +<ResponseField name="team_id" type="number"> |
| 44 | + This is the internal ID for this user group. You don't need to record this information, since |
| 45 | + you will not need to use it. |
| 46 | +</ResponseField> |
| 47 | + |
| 48 | +<ResponseField name="token" type="string"> |
| 49 | + This is the user group token (userGroupToken or USER_GROUP_TOKEN) that will be used to identify |
| 50 | + which user group is viewing the dashboard. You should save this on your end to use when rendering |
| 51 | + an embedded dashboard. |
| 52 | +</ResponseField> |
| 53 | + |
| 54 | +<ResponseField name="name" type="string"> |
| 55 | + This is the name of the user group provided in the request body. |
| 56 | +</ResponseField> |
| 57 | + |
| 58 | +<ResponseField name="provided_id" type="string"> |
| 59 | + This is the user_group_id provided in the request body. |
| 60 | +</ResponseField> |
| 61 | + |
| 62 | +<ResponseField name="properties" type="JSON or null"> |
| 63 | + This is the properties object if it was provided in the request body |
| 64 | +</ResponseField> |
| 65 | + |
| 66 | +</Expandable> |
| 67 | + |
| 68 | +</ResponseField> |
| 69 | + |
| 70 | +<RequestExample> |
| 71 | + |
| 72 | +```bash Example Request |
| 73 | +curl --location --request GET 'https://api.mintlify.com/api/user' \ |
| 74 | +--header 'Content-Type: application/json' \ |
| 75 | +--header 'Authorization: Token <token>' \ |
| 76 | +--data-raw '{ |
| 77 | + "user_group_id": "example_1", |
| 78 | + "name": "Example 1", |
| 79 | + "mapping": {"40": "213", "134": "386"}, |
| 80 | + "properties": {"filterValue": "value"} |
| 81 | +}' |
| 82 | +``` |
| 83 | + |
| 84 | +</RequestExample> |
| 85 | + |
| 86 | +<ResponseExample> |
| 87 | + |
| 88 | +```json Response |
| 89 | +{ |
| 90 | + "success": 1, |
| 91 | + "new_user_group": true, |
| 92 | + "user_group": { |
| 93 | + "team_id": 3, |
| 94 | + "token": "<user_group_token_to_auth_dashboard>", |
| 95 | + "name": "Example 1", |
| 96 | + "provided_id": "example_1" |
| 97 | + } |
| 98 | +} |
| 99 | +``` |
| 100 | + |
| 101 | +</ResponseExample> |
0 commit comments