To assign the image to unit, use the command unit/update_image:
Same as at the other (e.g. when you copy unit)
svc=unit/update_image¶ms={"itemId":<long>, "oldItemId":<long>}
From library:
svc=unit/update_image¶ms={"itemId":<long>, "libId":<long>, "path":<text>}
| Name | Description | 
|---|---|
| itemId | new unit ID | 
| oldItemId | old unit ID | 
| libId | ID of resource with image (for default library - 0) | 
| path | image file location | 
{} /* empty object if execution successful, if not - error code */