Создать сессию загрузки файла
Создает сессию для загрузки файла. Порядок загрузки файла:
- Создать сессию загрузки файла.
- Загрузить файл по частям с помощью метода Загрузить фрагмент файла.
- Завершить сессию загрузки c помощью метода Завершить сессию загрузки.
После завершения загрузки файл можно прикрепить к странице: Добавить прикрепленный файл.
Request
POST
https://api.wiki.yandex.net/v1/upload_sessions
Body
application/json
{
"file_name": "example",
"file_size": 0
}
|
Name |
Description |
|
file_name |
Type: string Example: |
|
file_size |
Type: integer |
Responses
200 OK
OK
Body
application/json
{
"session_id": "example",
"file_name": "example",
"file_size": 0,
"status": "not_started",
"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",
"finished_at": "2025-01-01T00:00:00Z",
"storage_type": "mds"
}
|
Name |
Description |
|
created_at |
Type: string<date-time> Example: |
|
file_name |
Type: string Example: |
|
file_size |
Type: integer |
|
session_id |
Type: string<uuid4> Example: |
|
status |
Type: UploadSessionStatusType An enumeration. Enum: |
|
user |
Type: UserSchema Example
|
|
finished_at |
Type: string<date-time> Example: |
|
storage_type |
Type: StorageType An enumeration. Enum: |
UploadSessionStatusType
An enumeration.
Type: string
Enum: not_started, in_progress, finished, aborted, used, cleanup
UserIdentity
|
Name |
Description |
|
cloud_uid |
Type: string Example: |
|
uid |
Type: string Example: |
Example
{
"uid": "example",
"cloud_uid": "example"
}
UserSchema
|
Name |
Description |
|
affiliation |
Type: string Example: |
|
display_name |
Type: string Example: |
|
id |
Type: integer |
|
is_dismissed |
Type: boolean |
|
username |
Type: string Example: |
|
identity |
Type: UserIdentity Example
|
Example
{
"id": 0,
"identity": {
"uid": "example",
"cloud_uid": "example"
},
"username": "example",
"display_name": "example",
"is_dismissed": true,
"affiliation": "example"
}
StorageType
An enumeration.
Type: string
Enum: mds, s3, custom_s3