album.sharing.setMode
bearer
Change owner publication mode
Supports private, unlisted and public publication. An optional alias is set atomically when publishing publicly. Leaving public for unlisted always rotates the bearer link. Publication, alias holds, link retirement and image history commit together.
Parameters
Passed by name in the params object.
| Name | Type | Required | Description |
|---|---|---|---|
album_id |
string | yes | |
mode |
string (enum) | yes | |
token |
string (enum) | no | |
alias |
string | no |
Result
Returns sharingDTO:
| Field | Type | Description |
|---|---|---|
album_id * |
string | |
alias_quota * |
aliasQuotaDTO |
|
aliases * |
array<aliasDTO> |
|
cover * |
coverDTO |
|
last_published_mode |
string | |
links * |
sharingLinksDTO |
|
mode * |
string | |
moderation |
sharingModerationDTO |
|
policy * |
sharingPolicyDTO |
|
published_at |
string | |
republish |
republishDTO |
|
server_publishing * |
boolean | |
state * |
string | |
stats * |
sharingStatsDTO |
Errors
| Code | Message | When |
|---|---|---|
2001 |
not_found |
No such resource owned by the caller. |
1003 |
forbidden |
Not the owner, or outside a token's scope. |
2002 |
validation_failed |
Malformed request; see error.data. |
2004 |
taken_down |
Moderation prevents this operation on the resource. |
See the error reference for the full catalog, including the authentication codes.
Example
Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "album.sharing.setMode",
"params": {
"album_id": "018f3a80-1c2d-7e00-9a00-0b1c2d3e4f50",
"mode": "private"
}
}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"album_id": "018f3a80-1c2d-7e00-9a00-0b1c2d3e4f50",
"mode": "private",
"state": "private",
"links": {},
"aliases": [],
"alias_quota": {
"used": 0,
"limit": 20
},
"policy": {
"show_location": false,
"show_date": true,
"show_camera": false,
"allow_download": false,
"feed": true,
"order": "taken_asc",
"cover_focus": "center"
},
"cover": {
"is_default": true,
"was_reset": false
},
"stats": {
"visible": 0,
"total": 0,
"breakdown": {
"processing": 0,
"failed": 0,
"too_small": 0,
"taken_down": 0
},
"exif": {
"location": {
"visible": 0,
"disabled_on_photo": 0
},
"date": {
"visible": 0,
"disabled_on_photo": 0
},
"camera": {
"visible": 0,
"disabled_on_photo": 0
}
},
"captioned": 0,
"exposing_location": 0
},
"server_publishing": true
}
}
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.sharing.setMode","params":{"album_id":"018f3a80-1c2d-7e00-9a00-0b1c2d3e4f50","mode":"private"}}'
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.sharing.setMode", params: {"album_id":"018f3a80-1c2d-7e00-9a00-0b1c2d3e4f50","mode":"private"},
}),
});
const { result, error } = await res.json();
Go
body := []byte(`{"jsonrpc":"2.0","id":1,"method":"album.sharing.setMode","params":{"album_id":"018f3a80-1c2d-7e00-9a00-0b1c2d3e4f50","mode":"private"}}`)
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)