album.crop.set
bearer
Add or update a folder crop rule (re-renders the folder)
Upserts a per-folder crop; every photo in the folder is re-rendered. code must match ^[a-z0-9][a-z0-9-]{0,31}$; at least one of width/height in 1-15000; mode defaults to fill, format to webp, quality to 80. Returns the recrop job id.
Parameters
Passed by name in the params object.
| Name | Type | Required | Description |
|---|---|---|---|
album_id |
string | yes | Folder UUID |
code |
string | yes | Crop code, ^[a-z0-9][a-z0-9-]{0,31}$ |
width |
integer | yes | Target width in px (0-15000) |
height |
integer | yes | Target height in px (0-15000) |
mode |
string | no | Fit mode; defaults to fill |
format |
string | no | Output format; defaults to webp |
quality |
integer | no | Encoder quality 1-100; defaults to 80 |
Result
Returns jobResult:
| Field | Type | Description |
|---|---|---|
job_id * |
integer |
Errors
| Code | Message | When |
|---|---|---|
2001 |
not_found |
No such resource owned by the caller. |
See the error reference for the full catalog, including the authentication codes.
Example
Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "album.crop.set",
"params": {
"album_id": "018f3a80-1c2d-7e00-9a00-0b1c2d3e4f50",
"code": "hero",
"width": 1200,
"height": 630,
"mode": "fill",
"format": "webp",
"quality": 82
}
}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"job_id": 4242
}
}
curl
curl -s https://peinture.gumeniuk.com/rpc \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"album.crop.set","params":{"album_id":"018f3a80-1c2d-7e00-9a00-0b1c2d3e4f50","code":"hero","width":1200,"height":630,"mode":"fill","format":"webp","quality":82}}'
JavaScript
const res = await fetch("https://peinture.gumeniuk.com/rpc", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `Bearer ${token}`,
},
body: JSON.stringify({
jsonrpc: "2.0", id: 1, method: "album.crop.set", params: {"album_id":"018f3a80-1c2d-7e00-9a00-0b1c2d3e4f50","code":"hero","width":1200,"height":630,"mode":"fill","format":"webp","quality":82},
}),
});
const { result, error } = await res.json();
Go
body := []byte(`{"jsonrpc":"2.0","id":1,"method":"album.crop.set","params":{"album_id":"018f3a80-1c2d-7e00-9a00-0b1c2d3e4f50","code":"hero","width":1200,"height":630,"mode":"fill","format":"webp","quality":82}}`)
req, _ := http.NewRequest("POST", "https://peinture.gumeniuk.com/rpc", bytes.NewReader(body))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", "Bearer "+token)
resp, err := http.DefaultClient.Do(req)