-
Notifications
You must be signed in to change notification settings - Fork 4
III.3.c. Files
/action/addFiles
Adds specified files to the target post if total post count does not exceed the maximum file count for the board. Returns an object containing the post number, board name and thread number.
The required fields are:
-
boardName
The board of the target post. -
postNumber
The number of the post to add files to.
The optional fields are:
-
password
The password that was specified when the post was created. Not required if thehashpass
cookie is set.
File field names should follow the template: file_ID
, where ID
is an identifier unique for each file.
Files may also be specified as URLs, in which case the field name must follow the template: file_url_ID
, where ID
is an identifier unique for each file URL, and the value of the field should be either a URL (for example, http://site.com/files/image.jpg
), or a special URL-like string, like: vk://UID_TID/TITLE
, where UID
is a Vkontakte user ID, TID
is a Vkontakte audio track ID, and TITLE
is a track title. In that case, the file or a Vkontakte audio-track will be downloaded by the server.
One more option to attach file(s) is to pass a list of file hashes, separated by commas as a value of the fileHashes
field. In that case, the files will be copied if they exist in the database.
To set file rating, the file_ID_rating
field may be used, where ID
matches the ideintifier of file_ID
or file_url_ID
fields, or the hash of the corresponding file passed in the fileHashes
field. The following file ratings are supported:
-
SFW
Safe for work (no socially condemned content). The default. -
R-15
Restricted for 15 years (contains ecchi, idols, violence). -
R-18
Restricted for 18 years (genitalis, coitus, offensive religious/racist/nationalist content). -
R-18G
Restricted for 18 years, guidance advised (shemale, death, guro, scat, defecation, urination, etc.).
Example:
/action/addFiles { boardName=b&postNumber=12345&file_url_1=http://site.com/files/image.png }
{
"boardName": "b",
"postNumber": 12345,
"threadNumber": 9000
}
On any error, an error object is returned.
Example:
/action/addFiles { boardName=b&postNumber=12345&file_url_1=http://site.com/files/image.png }
{
"title": "Error",
"errorMessage": "Error",
"errorDescription": "Too many files"
}
/action/deleteFile
Deletes the specified file. If the corresponding post text is null and there are no other files attached to the post, the operation will fail. Returns an object containing the post number, board name and thread number.
The required fields are:
-
fileName
The name of the target file.
The optional fields are:
-
password
The password that was specified when the post the file is attached to was created. Not required if thehashpass
cookie is set.
Example:
/action/deleteFile { fileName=1456149490808.jpg }
{
"boardName": "b",
"postNumber": 12345,
"threadNumber": 9000
}
On any error, an error object is returned.
Example:
/action/deleteFile { fileName=1456149490808.png }
{
"title": "Error",
"errorMessage": "Error",
"errorDescription": "No such file"
}
/action/editFileRating
Changes the specified file's rating. Returns an object containing the post number, board name and thread number.
The required fields are:
-
fileName
The name of the target file.
The optional fields are:
-
rating
The new rating. -
password
The password that was specified when the post the file is attached to was created. Not required if thehashpass
cookie is set.
Example:
/action/editFileRating { fileName=1456102254423.mp3&rating=R-18 }
{
"boardName": "b",
"postNumber": 12345,
"threadNumber": 9000
}
On any error, an error object is returned.
Example:
/action/editFileRating { fileName=1456080943512.jpg&rating=R-18 }
{
"title": "Error",
"errorMessage": "Error",
"errorDescription": "No such file"
}
/action/editAudioTags
Changes the specified audio file's tags. Returns an object containing the post number, board name and thread number.
The required fields are:
-
fileName
The name of the target file.
The optional fields are:
-
album
Track album. -
artist
Track artist. -
title
Track title. -
year
Track release year. -
password
The password that was specified when the post the file is attached to was created. Not required if thehashpass
cookie is set.
Note: This request will only succeed if the target file is an audio file (mime type is audio/*
).
Example:
/action/editAudioTags { fileName=1456102254423.mp3&title=the_title }
{
"boardName": "b",
"postNumber": 12345,
"threadNumber": 9000
}
On any error, an error object is returned.
Example:
/action/editAudioTags { fileName=1456080943512.jpg&title=the_title }
{
"title": "Error",
"errorMessage": "Error",
"errorDescription": "Not an audio file"
}