# Update computer or user targets using domain and value pairs Updates the targets of an existing collection, configuration using domain and value pairs. **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 resources (Computer or User) must be within the technician's assigned scope. To look up resource Domain and name for collection, use [ComputerDetails](https://www.manageengine.com/products/desktop-central/help/api/onpremise/computers-getcomputers.html) to get all computers. This is the default format. Omit `useResourceIdFormat` from the request body, or set it to false explicitly. ## Endpoint `PUT /dcapi/target/{collectionId}/modifyTargets` ## Request URL `https://{server-hostname}:8383/dcapi/target/{collectionId}/modifyTargets` ## Scope `Configurations.UPDATE` (or) `SWDeployment.UPDATE` (or) `PatchMgmt.UPDATE` (or) `VulnerabilityMgmt.UPDATE` ## Header `Authorization: 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/onpremise/deployment-fw-get-configurations-view.html). ### Request Body `application/json` - `JSON Object` - **useResourceIdFormat** `boolean` — Optional - Mandatory. Must be false (or omitted) to activate the legacy name/domain path. When true, use `targetDetails` (Resource ID 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. - **targets** `JSON Array` — Optional - Mandatory when `useResourceIdFormat=false`. Array containing a single filter entry with name/domain pairs. Must NOT be combined with `targetDetails`. Minimum 1 item; minimum 1 value inside `filter.values`. ## Sample Request ```curl curl --request PUT \ --url https://appdomain/dcapi/target/{collectionId}/modifyTargets \ --header 'Accept: application/modifyTargets.v1+json' \ --header 'Authorization: d92d4xxxxxxxxxxxxx15f52' \ --header 'Content-Type: application/modifyTargets.v1+json' \ --data '{"appendTargets":false,"useResourceIdFormat":false,"targets":[{"filter":{"isDomainMainTarget":false,"values":[{"domain":"CORP","value":"PC-001"},{"domain":"CORP","value":"LAPTOP-DEF"}],"type":"Computer"}}]}' ``` ## Sample Request Body ### Replace all targets for a computer-type collection using domain/value pairs ```json { "appendTargets": false, "useResourceIdFormat": false, "targets": [ { "filter": { "isDomainMainTarget": false, "values": [ { "domain": "CORP", "value": "PC-001" }, { "domain": "CORP", "value": "LAPTOP-DEF" } ], "type": "Computer" } } ] } ``` ### Append a new user target to an existing user-type collection ```json { "appendTargets": true, "useResourceIdFormat": false, "targets": [ { "filter": { "isDomainMainTarget": false, "values": [ { "domain": "CORP", "value": "jsmith" } ], "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/onpremise/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 returned when authentication credentials are missing, expired, or invalid (authentication=required) - **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 Response: HTTP 200 ### REPLACE mode — targets fully replaced with the resolved domain/value pairs ```json { "mode": "REPLACE", "totalTargets": 2, "collectionId": 12345, "status": "Updated" } ``` ### APPEND mode — new targets merged into the existing list ```json { "mode": "APPEND", "totalTargets": 5, "collectionId": 67890, "status": "Updated" } ``` ## Sample Response: HTTP 400 ### A domain/value pair could not be matched to any managed resource ```json { "error_description": "BADPC.CORP - Invalid target Value", "error_code": "CONFIG_INVALID_INPUT_DATA" } ``` ### The targets array is empty ```json { "error_description": "'targets' array is empty", "error_code": "CONFIG_INVALID_INPUT_DATA" } ``` ## Sample Response: 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" } ``` ## Sample Response: HTTP 500 ### Unexpected failure during target resolution or collection update ```json { "error_description": "Error resolving targets. 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.