# Creates a static unique custom group with exclusive resource membership Creates a static unique custom group (groupCategory=5) with explicit member resources. Only computer-type static unique groups are supported — user-type static unique groups are not allowed. Static Unique groups are used for Scope of Management — they enforce that each resource belongs to only ONE static unique group of the same type, enabling non-overlapping technician territories. Unlike regular Static groups where a resource can belong to multiple groups, Static Unique groups reject any resource already in another Static Unique group. Required: `groupName`, `groupType=1`, `groupCategory=5`, `resourceIds`. Prerequisites: Call [Get Available Resources](https://www.manageengine.com/products/desktop-central/custom-groups-get-available-resources.html) to discover valid resource IDs. ## Endpoint **POST** `/api/1.4/customgroup/addCg` ## Request URL ``` https://{serverurl}/api/1.4/customgroup/addCg ``` `{serverurl}`: See [OAuth Authentication Endpoint Domain](https://www.manageengine.com/products/desktop-central/oauth-authentication-endpoint-domain.html) ## Scope ``` DesktopCentralCloud.Common.UPDATE ``` ## Header ``` Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52 ``` ## Request Parameters ### Request Headers - **Content-Type** (string, Mandatory): `application/json` Must be application/json. Request body must be valid JSON. - **Accept** (string, Mandatory): `application/json` Must be application/json. Only JSON responses are supported. ### Request Body **Content-Type:** `application/json` **Type:** JSON object #### Attributes - **groupName** (string, Mandatory) Name for the new group. Must be unique. Max 100 chars. Forbidden characters: `` ` \ : ; < > ? * " | & # % / `` - **groupCategory** (string, Mandatory) Must be `5` for static unique groups. - **groupType** (string, Mandatory) Must be `1` (Computers). Static unique custom groups only support computer-type — user-type static unique groups are not supported. - **description** (string, Optional) Group description. Max 250 chars. Double quotes not allowed. - **resourceIds** (array, Mandatory) Array of resource IDs. Members must be exclusive — each resource can only belong to ONE static unique group of the same type. Resources already in another static unique group will be reported in `invalidResourceIds`. Fetch IDs from [Get Available Resources](https://www.manageengine.com/products/desktop-central/custom-groups-get-available-resources.html). ## Sample Request ### Curl ```bash curl --request POST \ --url https://appdomain/api/1.4/customgroup/addCg \ --header 'Accept: application/json' \ --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \ --header 'Content-Type: application/json' \ --data '{"groupName":"Privileged Servers","groupType":1,"groupCategory":5,"resourceIds":[101,102]}' ``` ### Java ```java import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.io.IOException; import java.net.http.HttpTimeoutException; public class Main { public static void main(String[] args) { HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://appdomain/api/1.4/customgroup/addCg")) .header("Content-Type", "application/json") .header("Accept", "application/json") .header("Authorization", "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52") .method("POST", HttpRequest.BodyPublishers.ofString("{\"groupName\":\"Privileged Servers\",\"groupType\":1,\"groupCategory\":5,\"resourceIds\":[101,102]}")) .build(); HttpResponse response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString()); System.out.println(response.body()); } } ``` ### Python ```python import http.client conn = http.client.HTTPSConnection("appdomain") payload = "{\"groupName\":\"Privileged Servers\",\"groupType\":1,\"groupCategory\":5,\"resourceIds\":[101,102]}" headers = { 'Content-Type': "application/json", 'Accept': "application/json", 'Authorization': "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52" } conn.request("POST", "/api/1.4/customgroup/addCg", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ### Deluge ```javascript headersMap = Map(); headersMap.put("Content-Type", "application/json"); headersMap.put("Accept", "application/json"); data=Map(); data.put("groupName","value"); data.put("groupType","value"); data.put("groupCategory","value"); data_resourceIds=List(); data.put("resourceIds",data_resourceIds); response = invokeUrl [ url: "https://appDomain/api/1.4/customgroup/addCg" type: POST headers: headersMap body: data connection: connection_name ] info response; ``` ### PowerShell ```powershell $headers=@{} $headers.Add("Content-Type", "application/json") $headers.Add("Accept", "application/json") $headers.Add("Authorization", "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52") $response = Invoke-WebRequest -Uri 'https://appdomain/api/1.4/customgroup/addCg' -Method POST -Headers $headers -ContentType 'application/json' -Body '{"groupName":"Privileged Servers","groupType":1,"groupCategory":5,"resourceIds":[101,102]}' ``` ## Sample Request Body Create a static unique computer group with exclusive members. ```json { "groupName": "Privileged Servers", "groupType": 1, "groupCategory": 5, "description": "Servers with restricted technician access", "resourceIds": [ 101, 102 ] } ``` ## Response Parameters ### HTTP 200 **Response Body:** `application/json` - **message_type** (string) Always `'addCg'` for this endpoint. - **message_response** (JSON object) Response payload container. - **addcg** (JSON object) Response payload. - **cgResourceId** (string) Newly assigned resource ID (returned as string). Use as `cgId` in [Delete CG](https://www.manageengine.com/products/desktop-central/custom-groups-delete-cg.html), or as `groupId` in the request body of [Update Static CG](https://www.manageengine.com/products/desktop-central/custom-groups-update-static-cg.html) or [Update Static Unique CG](https://www.manageengine.com/products/desktop-central/custom-groups-update-static-unique-cg.html). - **groupName** (string) Name of the created group (echoed from request). - **groupCategory** (string) Numeric category as string: `'1'` = Static, `'5'` = Static Unique. - **groupType** (string) Group type as numeric string: `'1'` for Computers, `'2'` for Users. NOT the display name. - **invalidResourceIds** (array) [Conditional] Array of resource IDs that were not found or not valid. Present only when some submitted `resourceIds` are invalid. - **message_version** (string) API version: `'1.4'`. - **status** (string) `'success'` when the request completed without errors. ### Sample Response: HTTP 200 Static unique group created with assigned resource ID. ```json { "message_type": "addCg", "message_response": { "addcg": { "groupName": "Privileged Servers", "groupType": "1", "groupCategory": "5", "cgResourceId": "310" } }, "message_version": "1.4", "status": "success" } ``` Static unique group created but some exclusive member resource IDs were not found. ```json { "message_type": "addCg", "message_response": { "addcg": { "groupName": "Privileged Servers", "groupType": "1", "groupCategory": "5", "invalidResourceIds": [ 999, 998 ], "cgResourceId": "310" } }, "message_version": "1.4", "status": "success" } ``` ### HTTP 412 **Response Body:** `application/json` - **message_type** (string) Always `'addCg'`. - **message_version** (string) API version: `'1.4'`. - **status** (string) Always `'error'` for error responses. - **error_code** (string) `'70501'` (CG_CREATE_UPDATE_PARAMS_MISSING), `'70502'` (CG_DUPLICATE_NAME), `'70504'` (CG_INVALID_GROUP_TYPE), `'70505'` (CG_INVALID_GROUP_CATEGORY), `'70503'` (CG_NULL_CRITERIA_PATTERN), `'70517'` (CG_INVALID_CRITERIA_PATTERN), `'70508'` (CG_MORE_COMPUTERS_DUMMY_CG), `'70513'` (CG_INVALID_CREATION_MODE). - **error_description** (string) Resolved I18N message varies by error code: - `'Required parameters are missing to create/update Custom Group.'` (70501) - `'Custom group name is already in use.'` (70502) - `'Invalid group type.'` (70504) - `'Invalid group category.'` (70505) - `'Criteria pattern is empty.'` (70503) - `'Invalid criteria pattern.'` (70517) - `'Computer limit exceeded for free edition.'` (70508) - `'Only manually created Custom Group is allowed to be accessed using external apis.'` (70513) ### Sample Response: HTTP 412 A group with this name already exists. ```json { "error_description": "Custom group name is already in use.", "message_type": "addCg", "error_code": "70502", "message_version": "1.4", "status": "error" } ``` ### HTTP 500 **Response Body:** `application/json` - **message_type** (string) Always `'addCg'`. - **message_version** (string) API version: `'1.4'`. - **status** (string) Always `'error'`. - **error_code** (string) Internal error code: `'1003'` (INTERNAL_ERROR). - **error_description** (string) Resolved I18N message, typically: An internal error occurred while processing the request. ### Sample Response: HTTP 500 Unexpected server-side failure during group creation. ```json { "error_description": "An internal error occurred while processing the request.", "message_type": "addCg", "error_code": "1003", "message_version": "1.4", "status": "error" } ``` ## Possible Response Codes - **200** — HTTP code - **412** — HTTP code - **500** — HTTP code