Attachments

Basic information

Attachments is an object structure which composes different types of items.


+Attachments configuration

This section describes the configuration of attachments sent to the server.

The configuration represents an array of items and implements three actions:

Attachments Upload Temp File

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
    }
]

+Attachments structure

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://..."
    }]
}

+Images

Request

Request parameters vary depending on action:

Response


+Videos

Request

Request parameters vary depending on action:

Response


+Videorefs

Request

Request parameters vary depending on action:

Response


+Audios

Request

Request parameters vary depending on action:

Response


+Files

Request

Request parameters vary depending on action:

Response


Request parameters vary depending on action:


+Polls

Request

Request parameters vary depending on action:

Response


Definitions

AttachmentsImagesItemResponse

Name Description

id
unsigned integer

Attachment ID.

uid
unsigned integer

ID of a user who added the attachment.

filename
string

Original file name.

label
string

Name assigned by a user.

url
string

URL of the biggest allowed image copy.

width
unsigned integer

Width of the image.

height
unsigned integer

Height of the image.

thumbnail_url
string

Image thumbnail URL.

thumbnail_width
unsigned integer

Width of the thumbnail.

thumbnail_height
unsigned integer

Height of the thumbnail.

original (optional)
object

@OriginalInfo Original file info if available

AttachmentsVideosItemResponse

Name Description

id
unsigned integer

Attachment ID.

uid
unsigned integer

ID of a user who added the attachment.

label
string

Name assigned by a user.

filename
string

Original file name.

duration
float{.2}

Duration of the video in seconds.

original (optional)
object

@OriginalInfo Original file info if available

presets[]
object

@VideoPresets
A list of converted variants of the video.

snapshot
object

@VideoSnapshot
Snapshot details.

OriginalInfo

Name Description

url
string

File URL.

ext
string

File extension.

width
unsigned integer

Frame width.

height
unsigned integer

Frame height.

size
unsigned integer

File size in bytes.

VideoPresets

Name Description

width
unsigned integer

Width of the video frame.

height
unsigned integer

Height of the video frame.

ext
string

File extension.

label
string

Name of the preset.

url
string

Video URL.

size
string

File size in bytes.

VideoSnapshot

Name Description

width
unsigned integer

Width of the snapshot.

height
unsigned integer

Height of the snapshot.

ext
string

File extension.

url
string

Snapshot URL.

AttachmentsAudiosItemResponse

Name Description

id
unsigned integer

Attachment ID.

uid
unsigned integer

ID of a user who added the attachment.

label
string

Name assigned by a user.

title
string

Title of the song.

artist
string

Name of the singer.

url
string

Audio URL.

filename
string

Original file name.

ext
string

File extension.

duration
float{.3}

Duration of the audio in seconds.

size
unsigned integer

File size in bytes.

AttachmentsVideorefsItemResponse

Name Description

id
unsigned integer

Attachment ID.

uid
unsigned integer

ID of a user who added the attachment.

hoster
string

Hoster name (e.g. unet, youtube, dailymotion, vimeo, so on).

video_id
string

ID of the video provided by its hoster.

owner_id
string

ID of the video owner provided by its hoster.

owner
string

Name of the video owner provided by its hoster.

name
string

Video title.

descr
string

Video description.

duration
unsigned integer

Duration of the video in seconds.

video_url
string

Video URL.

thumbnail_url
string

Thumbnail URL.

AttachmentsFilesItemResponse

Name Description

id
unsigned integer

Attachment ID.

uid
unsigned integer

ID of a user who added the attachment.

label
string

Name assigned by a user.

url
string

File URL.

filename
string

Original file name.

ext
string

File extension.

size
unsigned integer

File size in bytes.

Name Description

id
unsigned integer

Attachment ID.

uid
unsigned integer

ID of a user who added the attachment.

label
string

Name assigned by a user.

url
string

Link URL.

name
string

Title of the page.

descr
string

Description of the page.

thumbnail_url
string

Thumbnail URL.

thumbnail_width
unsigned integer

Thumbnail width.

thumbnail_height
unsigned integer

Thumbnail height.

AttachmentsPollsItemResponse

Name Description

id
unsigned integer

Attachment ID.

All other fields correspond to the PollsItemResponse structure.

AttachmentsUplTempFileResponse

Name Description

tmpfilename
string

Temp filename in @AttachmentsConfiguration

file_extension
string

file_type
string

Uploadable attachment type according to @AttachmentType

file_size
unsigned integer

uri_prefix
string

Optional

file_name
string

Optional Original file name

Video

Fields related to file_type=video

video_width
unsigned integer

video_height
unsigned integer

video_duration
float

Fractional duration in seconds

snapshot_filename
string

prefix with uri_prefix to get URI of thumbnail img

snapshot_filesize
unsigned integer

snapshot_width
unsigned integer

snapshot_height
unsigned integer

Audio

Fields related to file_type=audio

audio_duration
float

Fractional duration in seconds

Image

Fields related to file_type=image

image_width
unsigned integer

image_height
unsigned integer

thumbnail_filename
string

prefix with uri_prefix to get URI of thumbnail img

preview_filename
string

prefix with uri_prefix to get URI of thumbnail img

preview_width
unsigned integer

preview_height
unsigned integer

@AttachmentsAddConfiguration

Name Description

type
string

@AttachmentType
Different modules can have it's own restrictions to allowed types

action
string

'add' - not required

upload_method
string

One of 'parameter_name' or 'tempfile', corresponding field must be present
Allowed for uploadable types only according to @AttachmentType

upload_tempfile
string

Name of already uploaded temporary file with file body.
Allowed for uploadable types only according to @AttachmentType

upload_parameter_name
string

Name of query param with file body.
Allowed for uploadable types only according to @AttachmentType

type specific params see on each type separetly

@AttachmentsAddUploadableConfiguration

Name Description

type
string

@AttachmentType
Different modules can have it's own restrictions to allowed types

action
string

'add' - not required

upload_method
string

One of 'parameter_name' or 'tempfile', corresponding field must be present

upload_tempfile
string

Name of already uploaded temporary file with file body.

upload_parameter_name
string

Name of query param with file body.

Name Description

type
string

'link'

action
string

'add' - not required

uri
string

New uri

title
string

Page title

description
string

Page description

image_uri
string

Page image (article image)

image_width
unsigned integer

image_height
unsigned integer

@AttachmentsEditConfiguration

Name Description

action
string

'edit'

id
number

type specific params see on each type separetly

@AttachmentsEditUploadableConfiguration

Name Description

action
string

'edit'

id
number

label
string

Text representation for attachment

Name Description

action
string

'edit'

id
number

uri
string

New uri

title
string

Page title

description
string

Page description

@AttachmentsDeleteConfiguration

Name Description

action
string

'delete'

id
number

@AttachmentType

  • image (uploadable)
  • video (uploadable)
  • audio (uploadable)
  • file (uploadable)
  • videoref
  • poll
  • link