Attachments is an object structure which composes different types of items.
This section describes the configuration of attachments sent to the server.
The configuration represents an array
of items and implements three actions:
Some modules can have their own upload_tempfile endpoinst that will return tmpfilename
to
use in add configuration with method tmpfile.
Attachments configuration parameters vary depending on the type:
Example
[
{
"action":"add",
...parameters depending on the type of attachment...
},
{
"action":"edit",
"id":3,
...parameters depending on the type of attachment...
},
{
"action":"delete",
"id":2
}
]
This section describes the structure of attachments obtained from the server.
The structure represents an object
of substructures describing the following types:
Example
{
"images": [{
"id": 2,
"user_id": 000,
"label": "My Picture",
"filename": "picture.png",
"url": "http://...",
"height": 128,
"width": 128,
"thumbnail_url": "http://...",
"thumbnail_height": 227,
"thumbnail_width": 302,
"original": {
"ext": "png",
"size": 312312,
"height": 1200,
"width": 1920,
"url": "https://..."
}
}],
"videos": [{
"id": 11,
"user_id": 256,
"label": "The best video",
"filename": "video.mp4",
"duration": 30.51,
"original": {
"ext": "mp4",
"size": 15430247,
"url": "http://...",
"height": 1072,
"width": 1072,
},
"presets": [{
"label": "480p (mp4)",
"ext": "mp4",
"size": 2660887,
"url": "http://...",
"height": 480,
"width": 480
},
{
"label": "720p (mp4)",
"ext": "mp4",
"size": 4762231,
"url": "http://...",
"height": 720,
"width": 720
}],
"snapshot": {
"ext": "jpg",
"width": 1072,
"height": 1072,
"url": "http://...",
}
}],
"videorefs": [{
"id": 3,
"user_id": 000,
"label": "Dobby is free!",
"video_id": "EHPSY3QrgnI",
"hoster": "youtube",
"owner": "SirDobby276",
"owner_id": "UCT4WKI1KIGqhuUUkT5mtdoA",
"name": "Dobby is free!",
"descr": "",
"duration": 136,
"thumbnail_url": "http://..."
}],
"files": [{
"id": 1,
"user_id": 000,
"label": "Real File",
"filename": "Document.html",
"ext": "html",
"size": 98432,
"url": "http://..."
}],
"audios": [{
"id": 5,
"user_id": 000,
"label": "The Best Song Ever",
"filename": "song.mp3",
"ext": "mp3",
"size": 2370437,
"duration": 118.413,
"artist": "Jesse Harlin",
"title": "Vode An (Brothers All)",
"url": "http://..."
}]
}
Request parameters vary depending on action:
Request parameters vary depending on action:
Request parameters vary depending on action:
Request parameters vary depending on action:
Request parameters vary depending on action:
Request parameters vary depending on action:
Request parameters vary depending on action:
Name | Description |
---|---|
id |
Attachment ID. |
uid |
ID of a user who added the attachment. |
filename |
Original file name. |
label |
Name assigned by a user. |
url |
URL of the biggest allowed image copy. |
width |
Width of the image. |
height |
Height of the image. |
thumbnail_url |
Image thumbnail URL. |
thumbnail_width |
Width of the thumbnail. |
thumbnail_height |
Height of the thumbnail. |
original (optional) |
@OriginalInfo Original file info if available |
Name | Description |
---|---|
id |
Attachment ID. |
uid |
ID of a user who added the attachment. |
label |
Name assigned by a user. |
filename |
Original file name. |
duration |
Duration of the video in seconds. |
original (optional) |
@OriginalInfo Original file info if available |
presets[] |
@VideoPresets |
snapshot |
@VideoSnapshot |
Name | Description |
---|---|
url |
File URL. |
ext |
File extension. |
width |
Frame width. |
height |
Frame height. |
size |
File size in bytes. |
Name | Description |
---|---|
width |
Width of the video frame. |
height |
Height of the video frame. |
ext |
File extension. |
label |
Name of the preset. |
url |
Video URL. |
size |
File size in bytes. |
Name | Description |
---|---|
width |
Width of the snapshot. |
height |
Height of the snapshot. |
ext |
File extension. |
url |
Snapshot URL. |
Name | Description |
---|---|
id |
Attachment ID. |
uid |
ID of a user who added the attachment. |
label |
Name assigned by a user. |
title |
Title of the song. |
artist |
Name of the singer. |
url |
Audio URL. |
filename |
Original file name. |
ext |
File extension. |
duration |
Duration of the audio in seconds. |
size |
File size in bytes. |
Name | Description |
---|---|
id |
Attachment ID. |
uid |
ID of a user who added the attachment. |
hoster |
Hoster name (e.g. unet, youtube, dailymotion, vimeo, so on). |
video_id |
ID of the video provided by its hoster. |
owner_id |
ID of the video owner provided by its hoster. |
owner |
Name of the video owner provided by its hoster. |
name |
Video title. |
descr |
Video description. |
duration |
Duration of the video in seconds. |
video_url |
Video URL. |
thumbnail_url |
Thumbnail URL. |
Name | Description |
---|---|
id |
Attachment ID. |
uid |
ID of a user who added the attachment. |
label |
Name assigned by a user. |
url |
File URL. |
filename |
Original file name. |
ext |
File extension. |
size |
File size in bytes. |
Name | Description |
---|---|
id |
Attachment ID. |
uid |
ID of a user who added the attachment. |
label |
Name assigned by a user. |
url |
Link URL. |
name |
Title of the page. |
descr |
Description of the page. |
thumbnail_url |
Thumbnail URL. |
thumbnail_width |
Thumbnail width. |
thumbnail_height |
Thumbnail height. |
Name | Description |
---|---|
id |
Attachment ID. |
All other fields correspond to the PollsItemResponse structure. |
Name | Description |
---|---|
tmpfilename |
Temp filename in @AttachmentsConfiguration |
file_extension |
|
file_type |
Uploadable attachment type according to @AttachmentType |
file_size |
|
uri_prefix |
Optional |
file_name |
Optional Original file name |
Video |
Fields related to file_type=video |
video_width |
|
video_height |
|
video_duration |
Fractional duration in seconds |
snapshot_filename |
prefix with |
snapshot_filesize |
|
snapshot_width |
|
snapshot_height |
|
Audio |
Fields related to file_type=audio |
audio_duration |
Fractional duration in seconds |
Image |
Fields related to file_type=image |
image_width |
|
image_height |
|
thumbnail_filename |
prefix with |
preview_filename |
prefix with |
preview_width |
|
preview_height |
Name | Description |
---|---|
type |
@AttachmentType |
action |
'add' - not required |
upload_method |
One of 'parameter_name' or 'tempfile', corresponding field must be present |
upload_tempfile |
Name of already uploaded temporary file with file body. |
upload_parameter_name |
Name of query param with file body. |
type specific params see on each type separetly |
Name | Description |
---|---|
type |
@AttachmentType |
action |
'add' - not required |
upload_method |
One of 'parameter_name' or 'tempfile', corresponding field must be present |
upload_tempfile |
Name of already uploaded temporary file with file body. |
upload_parameter_name |
Name of query param with file body. |
Name | Description |
---|---|
type |
'link' |
action |
'add' - not required |
uri |
New |
title |
Page title |
description |
Page description |
image_uri |
Page image (article image) |
image_width |
|
image_height |
Name | Description |
---|---|
action |
'edit' |
id |
|
type specific params see on each type separetly |
Name | Description |
---|---|
action |
'edit' |
id |
|
label |
Text representation for attachment |
Name | Description |
---|---|
action |
'edit' |
id |
|
uri |
New |
title |
Page title |
description |
Page description |
Name | Description |
---|---|
action |
'delete' |
id |