update_image

To set or change a unit icon, execute the unit/update_image method.

To copy an icon from another unit, use the following signature:

Copied!
svc=unit/update_image&params={
    "itemId": <long>,
    "oldItemId": <long>
}

To use an icon from the library, use the following signature:

Copied!
svc=unit/update_image&params={
    "itemId": <long>,
    "libId": <long>,
    "path": <text>
}

Parameters

The request must contain the following parameters:

Parameter Description
itemId ID of the unit to which you want to apply the icon.
oldItemId ID of the unit from which you want to copy the icon.
libId ID of the resource in which the necessary image is stored. To use the default library, pass 0.
path Path to the image file.

Response

If the request is completed successfully, an empty object is returned:

Copied!
{}

Otherwise, an error code is returned.

Error codes

Error code Description
4 Wrong input parameters: itemId is missing or has a wrong type, or the request contains neither oldItemId nor libId with path.
6 Failed to set or change the unit icon.
7 The unit or unit group doesn’t exist, the user doesn’t have the Change icon access right to it, or the unit specified in oldItemId isn’t available.

If you find a mistake in the text, please select it and press Ctrl+Enter.