# Updates a dynamic custom group's name, description, or criteria list Updates a dynamic custom group (groupCategory=2). Requires `groupId`. Only computer-type dynamic groups exist (user-type dynamic is not supported). The `criteriaList` field replaces all existing criteria entirely — members are re-evaluated after update. If `criteriaPattern` is omitted, the existing join pattern stored on the group is preserved. **Important:** Do not include `groupType` or `groupCategory` in the request body — these are immutable after creation and will be rejected. **Prerequisites:** - Call [Get Dynamic CG Criteria Pattern](https://www.manageengine.com/products/desktop-central/custom-groups-get-dynamic-cgcriteria-pattern.html) to discover available columns and operators. - Call [Get Dynamic CG Column Values](https://www.manageengine.com/products/desktop-central/custom-groups-get-dynamic-cgcolumn-values.html) to fetch valid comparison values. ## Endpoint `POST /api/1.4/customgroup/updateCg` ## Request URL ``` https://{serverurl}/api/1.4/customgroup/updateCg ``` `{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 `application/json` #### groupId (long, Mandatory) Resource ID of the group to update. Fetch from [Retrieve All Custom Groups](https://www.manageengine.com/products/desktop-central/custom-groups-get-cglist.html). #### groupName (string, Optional) Updated group name. Max 100 chars. #### description (string, Optional) Updated description. Max 250 chars. #### criteriaList (JSON array, Mandatory) Replaces existing criteria entirely. Members will be re-evaluated. Fetch available columns/operators from [Get Dynamic CG Criteria Pattern](https://www.manageengine.com/products/desktop-central/custom-groups-get-dynamic-cgcriteria-pattern.html). Each item in `criteriaList`: ##### columnId (long, Mandatory) Criteria column ID. Fetch from [Get Dynamic CG Criteria Pattern](https://www.manageengine.com/products/desktop-central/custom-groups-get-dynamic-cgcriteria-pattern.html). Column IDs are instance-specific — never hardcode them, always discover via the criteriaPattern endpoint. ##### logicalOperator (string, Mandatory) How this criteria joins with the next: - `AND` — both must match - `OR` — either matches ##### comparator (string, Mandatory) Comparison operator. Fetch applicable operators from [Get Dynamic CG Criteria Pattern](https://www.manageengine.com/products/desktop-central/custom-groups-get-dynamic-cgcriteria-pattern.html) via `applicableCriteriaType[].value`. Values: - `equal` - `not equal` - `contains` - `not contains` - `starts with` - `not starts with` - `ends with` - `greater than` - `greater or equal` - `less than` - `less or equal` - `between` - `not between` - `on` - `after` - `before` ##### criteriaValue (array, Mandatory) Array of string values to compare against. Multiple values act as OR within this criteria. Fetch available values from [Get Dynamic CG Column Values](https://www.manageengine.com/products/desktop-central/custom-groups-get-dynamic-cgcolumn-values.html). ##### additionalValues (JSON object, Optional) Script-based criteria only. Script execution parameters: exit code, script ID, name, and description. - **exitCode** (string, Optional) Comma-separated expected exit codes (e.g., `0` for success, `0,1` for success or warning). - **scriptId** (string, Optional) Resource ID of the custom script in the scripts repository. - **scriptName** (string, Optional) File name of the script (e.g., `ComplianceCheck.bat`). - **description** (string, Optional) Human-readable description of what the script checks. #### criteriaPattern (string, Optional) Updated criteria join pattern using 1-based indices (e.g., `1 AND 2`). If omitted, the existing pattern stored on the group is reused. ## Sample Request ### Curl ```bash curl --request POST \ --url https://appdomain/api/1.4/customgroup/updateCg \ --header 'Accept: application/json' \ --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \ --header 'Content-Type: application/json' \ --data '{"groupId":302,"criteriaList":[{"comparator":"contains","logicalOperator":"AND","columnId":1,"criteriaValue":["Windows 11"]},{"comparator":"equal","logicalOperator":"AND","columnId":3,"criteriaValue":["64-bit"]}]}' ``` ### 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/updateCg")) .header("Content-Type", "application/json") .header("Accept", "application/json") .header("Authorization", "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52") .method("POST", HttpRequest.BodyPublishers.ofString("{\"groupId\":302,\"criteriaList\":[{\"comparator\":\"contains\",\"logicalOperator\":\"AND\",\"columnId\":1,\"criteriaValue\":[\"Windows 11\"]},{\"comparator\":\"equal\",\"logicalOperator\":\"AND\",\"columnId\":3,\"criteriaValue\":[\"64-bit\"]}]}")) .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 = "{\"groupId\":302,\"criteriaList\":[{\"comparator\":\"contains\",\"logicalOperator\":\"AND\",\"columnId\":1,\"criteriaValue\":[\"Windows 11\"]},{\"comparator\":\"equal\",\"logicalOperator\":\"AND\",\"columnId\":3,\"criteriaValue\":[\"64-bit\"]}]}" headers = { 'Content-Type': "application/json", 'Accept': "application/json", 'Authorization': "Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52" } conn.request("POST", "/api/1.4/customgroup/updateCg", 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("groupId","1"); data_criteriaList = List(); data_criteriaList_item1 = Map(); data_criteriaList_item1.put("comparator","value"); data_criteriaList_item1.put("logicalOperator","value"); data_criteriaList_item1.put("columnId","1"); data_criteriaList_item1_criteriaValue = List(); data_criteriaList_item1.put("criteriaValue",data_criteriaList_item1_criteriaValue); data_criteriaList.add(data_criteriaList_item1); data.put("criteriaList",data_criteriaList); response = invokeUrl [ url: "https://appDomain/api/1.4/customgroup/updateCg" 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/updateCg' -Method POST -Headers $headers -ContentType 'application/json' -Body '{"groupId":302,"criteriaList":[{"comparator":"contains","logicalOperator":"AND","columnId":1,"criteriaValue":["Windows 11"]},{"comparator":"equal","logicalOperator":"AND","columnId":3,"criteriaValue":["64-bit"]}]}' ``` ## Sample Request Body Change criteria from a single OS filter to OS and architecture combined. ```json { "groupName": "Windows 11 PCs", "groupId": 302, "description": "Updated - Windows 11 64-bit workstations only", "criteriaList": [ { "comparator": "contains", "logicalOperator": "AND", "columnId": 1, "criteriaValue": [ "Windows 11" ] }, { "comparator": "equal", "logicalOperator": "AND", "columnId": 3, "criteriaValue": [ "64-bit" ] } ], "criteriaPattern": "1 AND 2" } ``` ## Response Parameters ### HTTP 200 Response Body — `application/json` #### message_type (string) Always `updateCg` for this endpoint. #### message_response (JSON object) Response payload container. - **updatecg** (JSON object) Response payload. - **cgResourceId** (string) Resource ID of the updated group (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 a subsequent [Update Dynamic CG](https://www.manageengine.com/products/desktop-central/custom-groups-update-dynamic-cg.html) call. - **groupName** (string) Current name after update. #### message_version (string) API version: `1.4`. #### status (string) `success` when the request completed without errors. ### HTTP 404 Response Body — `application/json` - **message_type** (string) — `updateCg` - **message_version** (string) — `1.4` - **status** (string) — `error` - **error_code** (string) — `70506` (CG_INVALID_DETAILS_TO_UPDATE) - **error_description** (string) — `No such Custom Group found.` — group does not exist, user is out of scope, or group is invalid for current product edition. ### HTTP 412 Response Body — `application/json` - **message_type** (string) — `updateCg` - **message_version** (string) — `1.4` - **status** (string) — `error` - **error_code** (string) — One of: - `70501` (CG_CREATE_UPDATE_PARAMS_MISSING) - `70502` (CG_DUPLICATE_NAME) - `70509` (CG_DUMMY_CG_RENAME) - `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. ### HTTP 500 Response Body — `application/json` - **message_type** (string) — `updateCg` - **message_version** (string) — `1.4` - **status** (string) — `error` - **error_code** (string) — `1003` (INTERNAL_ERROR) - **error_description** (string) — Typically: `An internal error occurred while processing the request.` ## Possible Response Codes - `200` - `404` - `412` - `500` ## Sample Response: HTTP 200 Criteria updated and member re-evaluation triggered. ```json { "message_type": "updateCg", "message_response": { "updatecg": { "groupName": "Windows 11 PCs", "cgResourceId": "302" } }, "message_version": "1.4", "status": "success" } ``` ## Sample Response: HTTP 404 Group ID does not exist or user lacks access. ```json { "error_description": "No such Custom Group found.", "message_type": "updateCg", "error_code": "70506", "message_version": "1.4", "status": "error" } ``` ## Sample Response: HTTP 412 `groupId` or `criteriaList` is missing. ```json { "error_description": "Required parameters are missing to create/update Custom Group.", "message_type": "updateCg", "error_code": "70501", "message_version": "1.4", "status": "error" } ``` ## Sample Response: HTTP 500 Unexpected server-side failure during update. ```json { "error_description": "An internal error occurred while processing the request.", "message_type": "updateCg", "error_code": "1003", "message_version": "1.4", "status": "error" } ```