SetMain

[POST] .../v1/itemimage/setmain

Selects the main item image. Choose an active image returned by ItemImage/Get to supply image_url in item lists, extended item cards and other item image views. The required id identifies an item image. The change clears the previous main flag and sets the selected image as main atomically; other items and other image categories are not affected. The response returns row_affected and ids of images whose main flag changed. Selecting the current main image succeeds with row_affected 0 and an empty ids array. The caller must have item image add permission. Missing body, invalid id, denied access, missing or deleted item images (1009) and storage errors are returned as HTTP 200 ErrorResult.

Request Parameters

Name Type Required Description
id Int64 Required ID of an active item image returned by ItemImage/Get.

Request Example

{
  "id": 501
}

Response Parameters

Name Type Description
ok Boolean Indicates whether the request completed successfully.
result Update Update operation result.

Response Example

{
  "ok": true,
  "result": {
    "row_affected": 2,
    "ids": [
      500,
      501
    ]
  }
}