Type to search...

Image: update

Updates an existing image tags and set up plugins. For changing the image name (public ID), please check the rename method.

Request

HTTP request

PUT /image/v1/c/<cloudId>/o/<publicId>  HTTP/1.1

or

PATCH /image/v1/c/<cloudId>/o/<publicId>  HTTP/1.1

Parameters

Parameter name Value Description
Path parameters
cloudId string ID of cloud
publicId string Public ID of image

Request Body

Property name Value Description
tags array/null Set image tags
plugins string/null Set image plugins.

Response

If successful, this method returns a image resource in the response body.

Response HTTP status code

HTTP status code Description
200 Success

For more information about HTTP codes, click here.

Rate limit

Detailed information for image rate limitation is available on Shardimage developers.

SDKL

Let’s set tag to every image in a cloud.

use shardimage\shardimagephp\auth\Client;
 
$client = new Client([
    'apiKey' => '<apiKey>',
    'apiSecret' => '<apiSecret>',
    'imageSecret' => '<imageSecret>',
]);
 
$images = $client->image()->index([  // list of images from the cloud. Let's say it's a small cloud, we don't care about pageToken now
    'cloudId' => '<cloudId>',
])->models;
 
$client->defer(true); // turning on batch request
foreach ($images as $image) {
    $client->image()->update($image, [
        'tags' => ['avatars', 'mysite-avatars']  // setting image tags. It will overwrites the original image tags if there were.
    ]);
}
$result = $client->defer(false); // turning off and sending batch request
Table of contents