65 lines
1.8 KiB
Markdown
65 lines
1.8 KiB
Markdown
# POST user group
|
|
This API call creates a user group.
|
|
|
|
#### Location
|
|
```
|
|
/api/v1/portal-management/user-groups/
|
|
```
|
|
|
|
#### Permissions required
|
|
`admin-access-control-user-groups` RW.
|
|
|
|
#### Body parameters
|
|
| Parameter | Type | Required | Description |
|
|
| ------------------ | ------- | -------- | --------------------------------------------- |
|
|
| user_group_name | string | yes | the name of the group being created. |
|
|
| user_group_slugify | slugify | yes | The slugify version of the name of the group. |
|
|
| user_group_weight | integer | yes | The group weight of the group being created. |
|
|
| user_group_type | enum | yes | Either `admin` or `user`. |
|
|
>[!INFO]
|
|
>The `user_group_name` cannot be `superuser` since this name is reserved.
|
|
|
|
### Example Body (json)
|
|
```json
|
|
{
|
|
"user_group_name": "test group",
|
|
"user_group_slugify": "test-group",
|
|
"user_group_weight": 51,
|
|
"user_group_type": "admin"
|
|
}
|
|
```
|
|
|
|
### Example Request
|
|
```php
|
|
$curl = curl_init();
|
|
|
|
curl_setopt_array($curl, [
|
|
CURLOPT_URL => $baseUrl . '/api/v1/portal-management/user-groups/',
|
|
CURLOPT_RETURNTRANSFER => true,
|
|
CURLOPT_POST => true,
|
|
CURLOPT_POSTFIELDS => $json_payload,
|
|
CURLOPT_HTTPHEADER => [
|
|
'Authorization: Bearer ' . $token,
|
|
'Content-Type: application/json',
|
|
'X-HTTP-Method-Override: DELETE'
|
|
],
|
|
]);
|
|
|
|
$response = curl_exec($curl);
|
|
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
|
|
|
if ($response === false) {
|
|
echo curl_error($curl);
|
|
}
|
|
|
|
curl_close($curl);
|
|
```
|
|
|
|
### Example Response
|
|
```json
|
|
"User group created successfully"
|
|
```
|
|
|
|
#### Known errors or issues.
|
|
None are known at the time
|
|
If you do encounter issues and get an http code in return, check the response codes on this page. |