Attach File
Attaches one or more files to the page from the sessions specified in upload_sessions. The sessions
must be completed, intended for attaching files, and belong to the current user
and organization.
Attaching files requires permission to edit the page. To create an upload session, use
POST /v1/upload_sessions.
For common headers and authentication methods, see Access to the API. For sample scenarios, see API usage examples.
Request
POST
https://api.wiki.yandex.net/v1/pages/{idx}/attachments
Path parameters
|
Name |
Description |
|
idx |
Type: integer Page ID. The value of |
Body
application/json
{
"upload_sessions": [
"example"
]
}
|
Name |
Description |
|
upload_sessions |
Type: string<uuid4>[] IDs of completed file upload sessions whose files should be attached to the page Example
|
Responses
200 OK
OK
Body
application/json
{
"results": [
{
"id": 0,
"name": "example",
"is_downloadable": true,
"download_url": "example",
"size": "example",
"description": "example",
"user": {
"id": 0,
"identity": null,
"username": "example",
"display_name": "example",
"is_dismissed": true,
"affiliation": "example"
},
"created_at": "2025-01-01T00:00:00Z",
"mimetype": "example",
"has_preview": true,
"check_status": "ready"
}
]
}
|
Name |
Description |
|
results |
Type: AttachmentSchema[] Files attached to the page Example
|
UserIdentity
User identifier
|
Name |
Description |
|
cloud_uid |
Type: string User identifier in the cloud Example: |
|
uid |
Type: string Yandex user ID Example: |
Example
{
"uid": "example",
"cloud_uid": "example"
}
UserSchema
User information
|
Name |
Description |
|
affiliation |
Type: string User affiliation Example: |
|
display_name |
Type: string User display name Example: |
|
id |
Type: integer Internal user identifier |
|
is_dismissed |
Type: boolean The user is dismissed |
|
username |
Type: string User login Example: |
|
identity |
All of 1 type
User identifier in the system Example
|
Example
{
"id": 0,
"identity": {
"uid": "example",
"cloud_uid": "example"
},
"username": "example",
"display_name": "example",
"is_dismissed": true,
"affiliation": "example"
}
FileCheckStatusType
File antivirus scan status:
check: The file is being scanned.ready: The file is ready to use.deleted: The file has been deleted.infected: A virus was detected.error: An error occurred during the scan.
Type: string
Enum: check, ready, deleted, infected, error
AttachmentSchema
File attached to a page
|
Name |
Description |
|
created_at |
Type: string<date-time> Date and time the file was uploaded Example: |
|
description |
Type: string File description Example: |
|
download_url |
Type: string URL for downloading the file Example: |
|
has_preview |
Type: boolean A preview is available for the file |
|
id |
Type: integer Unique file ID |
|
mimetype |
Type: string File MIME type Example: |
|
name |
Type: string File name Example: |
|
size |
Type: string File size in mebibytes (MiB) Example: |
|
check_status |
All of 1 type
File antivirus check status Default: |
|
is_downloadable |
Type: boolean The file is available for download Default: |
|
user |
All of 1 type
User who uploaded the file Example
|
Example
{
"id": 0,
"name": "example",
"is_downloadable": true,
"download_url": "example",
"size": "example",
"description": "example",
"user": {
"id": 0,
"identity": {
"uid": "example",
"cloud_uid": "example"
},
"username": "example",
"display_name": "example",
"is_dismissed": true,
"affiliation": "example"
},
"created_at": "2025-01-01T00:00:00Z",
"mimetype": "example",
"has_preview": true,
"check_status": "ready"
}