# Update computer or user targets by resource IDs Updates the targets of an existing collection, configuration using numeric resource IDs. **Modes:** Pass `appendTargets=true` to add to existing targets (APPEND). Omit this parameter to replace all targets (REPLACE). Note: REPLACE is not supported for user targets - use APPEND instead. **Scope validation:** Each resource ID (Computer or User) must be within the technician's assigned scope. To look up resource IDs for collection, use [ComputerDetails](https://www.manageengine.com/products/desktop-central/help/api/cloud/computers-getcomputers.html) to get all computers. To use this endpoint, set `useResourceIdFormat=true` in the request body. ## Endpoint `PUT /dcapi/target/{collectionId}/modifyTargets` ## Request URL `https://[{serverurl}](https://www.manageengine.com/products/desktop-central/help/api/cloud/oauth-authentication-endpoint-domain.html)/dcapi/target/{collectionId}/modifyTargets` ## Scope `DesktopCentralCloud.Configurations.UPDATE`, `DesktopCentralCloud.SWDeployment.UPDATE`, `DesktopCentralCloud.PatchMgmt.UPDATE`, `DesktopCentralCloud.VulnerabilityMgmt.UPDATE` ## Header `Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52` ## Request Parameters ### Request Headers - **Content-Type** `string` **Mandatory**: `application/modifyTargets.v1+json` - **Accept** `string` **Mandatory**: `application/modifyTargets.v1+json` ### Path Parameters - **collectionId** `string` **Mandatory** The unique numeric identifier of the collection whose targets are to be updated. Fetch from [Get Configurations View](https://www.manageengine.com/products/desktop-central/help/api/cloud/deployment-fw-get-configurations-view.html). ### Request Body `application/json` - `JSON Object` - **useResourceIdFormat** `boolean` Optional Mandatory. Must be true to activate the new-format path. When false, use the `targets` array (legacy path) instead. - **appendTargets** `boolean` Optional Optional. When true, new targets are appended to the existing target list; duplicates are silently skipped. When false (default), existing targets are fully replaced by the supplied list. - **targetDetails** `JSON Object` Optional Mandatory when `useResourceIdFormat=true`. Target descriptor with type and resource IDs. Must NOT be combined with `targets` in the same request. ## Sample Request ```curl curl --request PUT \ --url https://appdomains/dcapi/target/{collectionId}/modifyTargets \ --header 'Accept: application/modifyTargets.v1+json' \ --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' \ --header 'Content-Type: application/modifyTargets.v1+json' \ --data '{}' ``` ## Sample Request Body ### Replace all targets for a computer-type collection with three resource IDs ```json { "appendTargets": false, "useResourceIdFormat": true, "targetDetails": { "isDomainMainTarget": false, "values": [ 1001, 1002, 1003 ], "type": "computer" } } ``` ### Append new user resource IDs to an existing user-type collection's target list ```json { "appendTargets": true, "useResourceIdFormat": true, "targetDetails": { "isDomainMainTarget": false, "values": [ 2005, 2006 ], "type": "user" } } ``` ## Response Parameters ### HTTP Code 200 Response Body: `application/json` - `JSON Object` - **collectionId** `long` The collection ID whose targets were updated. Fetch from [Get Configurations View](https://www.manageengine.com/products/desktop-central/help/api/cloud/deployment-fw-get-configurations-view.html). - **totalTargets** `string` Total number of assigned targets after the update operation (after APPEND merge or REPLACE). - **mode** `string` Update mode applied — `APPEND` when `appendTargets=true`, `REPLACE` when `appendTargets=false` (default). - **status** `string` Confirmation string — always `Updated` on success. ### HTTP Code 400 Response Body: `application/json` - `JSON Object` - **error_code** `string` `CONFIG_INVALID_INPUT_DATA`: request payload validation failed. Possible causes: missing required field (`useResourceIdFormat`, `targetDetails`, `targets`, `type`, or `values`); mutual-exclusivity violation (`targets` and `targetDetails` both supplied); unsupported target type (not `computer` or `user`); filter type mismatch between request and collection type; invalid, non-managed, or out-of-scope resource ID in values array; unresolved name/domain pair; or empty values array. - **error_description** `string` Specific message describing the first validation failure encountered. ### HTTP Code 401 Response Body: `application/json` - `JSON Object` - **errorCode** `long` Unauthorized error code: credentials missing, expired, or invalid. - **errorMsg** `string` Authentication failure reason. ### HTTP Code 500 Response Body: `application/json` - `JSON Object` - **error_code** `string` `CONFIG_INTERNAL_ERROR` or `SERVICE_NOT_AVAILABLE`: unexpected failure during target resolution, target payload generation, or collection update. - **error_description** `string` Message describing the internal server error. Contact your administrator. ## Possible Response Codes - `200` HTTP code - `400` HTTP code - `401` HTTP code - `500` HTTP code ## Sample Responses ### HTTP 200 #### REPLACE mode — targets fully replaced with the supplied IDs ```json { "mode": "REPLACE", "totalTargets": 3, "collectionId": 12345, "status": "Updated" } ``` #### APPEND mode — new targets merged into the existing list ```json { "mode": "APPEND", "totalTargets": 7, "collectionId": 67890, "status": "Updated" } ``` ### HTTP 400 #### One of the supplied resource IDs is invalid, non-managed, or out of the technician's scope ```json { "error_description": "Resource ID 9999 is invalid, not managed, or out of your scope.", "error_code": "CONFIG_INVALID_INPUT_DATA" } ``` #### The requested target type does not match the collection's existing type ```json { "error_description": "Filter type mismatch. Collection is of type 'Computer' but request contains type 'User'", "error_code": "CONFIG_INVALID_INPUT_DATA" } ``` ### HTTP 401 #### User lacks write role for this configuration type ```json { "error_description": "Access denied - You are not allowed to access the requested resource.", "error_code": "UAC_UNAUTHORIZED" } ``` ### HTTP 500 #### Unexpected failure during target payload generation or collection update ```json { "error_description": "Error validating resource IDs. Contact administrator.", "error_code": "CONFIG_INTERNAL_ERROR" } ``` ![](https://www.zohowebstatic.com/sites/zweb/images/people/ico-help.png) **Duration:** 1 minute | **Threshold:** 30 | **Lock period:** 5 minutes Duration - Time window for the threshold. Threshold - Number of API calls allowed within the specified duration. Lock Period - Wait time before consecutive API requests.