Qmery API

Service url

http(s)://api.qmery.com

Notes

  • api_token or username and password combination are required as _GET param
  • sort , sort_dir , page ,per_page are the superglobals which are checked in every request
  • sort : a list of validated params to sort the list with
  • sort_dir : direction of sort , a validated list
  • page : Specifies which page of the results you want to see. Defaults to 1 (not 0).
  • per_page : The number of results you want to get back per request. Defaults to 100.
  • method spoofig is available with _method as a _GET parameter
  • other variables in method spoofing should be sent as a _GET param.

Categories

Categories are the objects which videos are stored in.

Parameter Type Description Requirement
showdraft url param Show draft category Optional

Methods

  • List categories
  • View a certain category
  • Update a category
  • Delete a category
  • Add a category

List Categories

Request:

GET http://api.qmery.com/v1/groups.json?api_token=xxxxxxxxxx

Response:

[
    {
        "id": 646,
        "title": "Some title",
        "hash_id": "2M8A7OkveoWev4Zg",
        "description": "",
        "video_count": 9,
        "create_date": 1428382771,
        "last_modified": 1428382771
    },
    {
        "id": 611,
        "title": "Another title",
        "hash_id": "od2z7BpKYok3gxvN",
        "description": "",
        "video_count": 0,
        "create_date": 1425973490,
        "last_modified": 1425973490
    },
]

View a Category

Request:

GET http://api.qmery.com/v1/groups/[groupHashId].json?api_token=xxxxxxxxxx

Response:

{
    "id": 494,
    "title": "jigsaw9017",
    "hash_id": "z9MeyJqwPZp4QXmx",
    "description": "1234",
    "video_count": 4,
    "create_date": 1422088165,
    "last_modified": 1422088165,
    "videos": [
        {
            "id": 2071,
            "title": "",
            "description": "",
            "vastTag" : "",
            "viewed": 0,
            "length": 85,
            "userId": 123,
            "status": "not ready",
            "group_id": 494,
            "subtitles": [
            {
                "title": "\u0628\u062f\u0648\u0646 \u0646\u0627\u0645",
                "file": "http://storage.qmery.com/repository/9/55fd4f9ae7539.srt"
            },
            {
                "title": "\u0628\u062f\u0648\u0646 \u0646\u0627\u0645",
                "file": "http://storage.qmery.com/repository/9/55fd4fbc9b4a9.srt"
            }
        ],
            "video_quality": [
                {
                    "name": "256x144",
                    "width": 256,
                    "height": 144
                }
            ],
            "link": [],
            "thumbnail": [],
            "create_date": 1422090431,
            "modified_date": 1422090431
        },
        {
            "id": 2074,
            "title": "",
            "description": "",
            "viewed": 0,
            "length": 85,
            "userId": 123,
            "status": "not ready",
            "group_id": 494,
            "video_quality": [
                {
                    "name": "256x144",
                    "width": 256,
                    "height": 144
                }
            ],
            "link": [],
            "thumbnail": [],
            "create_date": 1422090877,
            "modified_date": 1422090877
        }
    ]
}

Updating a category

Request:

PUT http://api.qmery.com/v1/groups/[groupHashId].json?api_token=xxxxxxxxxx

Parameter Description
title Title of the category
description Description of the category

Response:

if the category has been updated the API will response with a 200 OK status code and the location to the updated category in Location HTTP header and a Group updated response text.

Deleting a category

Request:

DELETE http://api.qmery.com/v1/groups/[groupHashId].json?api_token=xxxxxxxxxx

Response:

if the category has been deleted the API will response with a 200 OK status code and the category details as described in Viewing a category. Will return a 404 Not Found status code with Category was not found message if the category is not found and/or does not belong to this user

Add a category

Request:

POST http://api.qmery.com/v1/groups.json?api_token=xxxxxxxxxx

Parameter Description
title Title of the category
description Description of the category

Response: a 201 Created code with the body of created category


Videos

Videos are the main objects to get to the users

List videos

Request:

GET http://api.qmery.com/v1/videos.json?api_token=xxxxxxxxxx

Response:

hash_id provided can be used for iframe mode too , simplye user http://qmery.com/v/[hash_id] to have the iframe.

[
    {
        "id": 2413,
        "hash_id": "elAke30vZW",
        "title": "zagaloo",
        "description": "",
        "viewed": 4,
        "length": 89,
        "userId": 123,
        "status": "ready",
        "group_id": 494,
        "group_name": "jigsaw9017",
        "video_quality": [
            {
                "name": "320x180",
                "width": 320,
                "height": 180
            },
            {
                "name": "256x144",
                "width": 256,
                "height": 144
            }
        ],
        "link": [
            {
                "format": "mp4",
                "quality": "320x180",
                "link": "http://storage.qmery.com/repository/9/2413-320x180.mp4"
            },
            {
                "format": "webm",
                "quality": "320x180",
                "link": "http://storage.qmery.com/repository/9/2413-320x180.webm"
            }
        ],
        "thumbnail": [
            "http://storage.qmery.com/repository/9/2413-000005.png",
            "http://storage.qmery.com/repository/9/2413-000053.png",
            "http://storage.qmery.com/repository/9/2413-000039.png",
            "http://storage.qmery.com/repository/9/2413-000054.png",
            "http://storage.qmery.com/repository/9/2413-000044.png"
        ],
        "create_date": 1422776861,
        "modified_date": 1422776936
    }
]

View video

Request:

GET http://api.qmery.com/v1/videos/[video hash id].json?api_token=xxxxxxxxxx

Response:

same as above but added a progress index which indicates the progress of encoding process between 0 and 1.

{
    "id": 2317,
    "hash_id": "G9v976oA01",
    "title": "qqqqqqqqqqqqqqqqqqqqqqqq",
    "description": "",
    "vastTag" : "",
    "viewed": 2,
    "length": 33,
    "userId": 123,
    "status": "ready",
    "group_id": 358,
    "group_name": "Majid",
    "subtitles": [
            {
                "title": "\u0628\u062f\u0648\u0646 \u0646\u0627\u0645",
                "file": "http://storage.qmery.com/repository/9/55fd4f9ae7539.srt"
            },
            {
                "title": "\u0628\u062f\u0648\u0646 \u0646\u0627\u0645",
                "file": "http://storage.qmery.com/repository/9/55fd4fbc9b4a9.srt"
            }
        ],    
    "video_quality": [
        {
            "name": "256x144",
            "width": 256,
            "height": 144
        }
    ],
    "link": [
        {
            "format": "mp4",
            "quality": "256x144",
            "link": "http://storage.qmery.com/repository/9/2317-256x144.mp4"
        },
        {
            "format": "webm",
            "quality": "256x144",
            "link": "http://storage.qmery.com/repository/9/2317-256x144.webm"
        }
    ],
    "thumbnail": [
        "http://storage.qmery.com/repository/9/2317-0.png"
    ],
    "create_date": 1422256589,
    "modified_date": 1428144531,
    "progress": 1
}

Updating video

Request:

PUT http://api.qmery.com/v1/videos/[video hash id].json?api_token=xxxxxxxxxx

Parameter Description
title Title of the video
autostart if sent will set to play video automaticly
hls if sent the video will be served in adaptive format
description Description of the video
user_id User id for developer options
player an array containing the fields you want to display in social bar.['twitter' ,'whatsapp', 'gplus', 'linkedin', 'tumblr', 'playcount', 'download', 'email', 'facebook', 'description', 'embed', 'viber', 'telegram'] are the available variables

Response:

if the video has been updated the API will response with a 200 OK status code and the location to the updated video in Location HTTP header and a Video updated response text.

Deleting a video

Request:

DELETE http://api.qmery.com/v1/videos/[videoHashId].json?api_token=xxxxxxxxxx

Response:

if the video has been deleted the API will response with a 200 OK status code and the video details as described in Viewing a video. Will return a 404 Not Found status code with Video was not found message if the video is not found and/or does not belong to this user

Probe a video

use to get useful information of a video

Request: POST http://api.qmery.com/v1/videos/probe.json?api_token=xxxxxxxxxx

Parameter Description
video_url URL of the video (Required)

Response

a json containing all the info about the video , you can find out the possibility of encoding from status index

{
    "datetime": "2015-11-18T15:05:19.69519847+03:30",
    "message": "Verify accepted.",
    "status": true,
    "probe": {
        "streams": [
            {
                "index": 0,
                "codec_name": "h264",
                "codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
                "profile": "High",
                "codec_type": "video",
                "width": 1280,
                "height": 720,
                "duration": "45.445400",
                "nb_frames": "1362",
                "disposition": {
                    "default": 1
                },
                "tags": {
                    "creation_time": ""
                }
            },
            {
                "index": 1,
                "codec_name": "aac",
                "codec_long_name": "AAC (Advanced Audio Coding)",
                "profile": "LC",
                "codec_type": "audio",
                "width": 0,
                "height": 0,
                "duration": "45.354667",
                "nb_frames": "2126",
                "disposition": {
                    "default": 1
                },
                "tags": {
                    "creation_time": ""
                }
            },
            {
                "index": 2,
                "codec_name": "mov_text",
                "codec_long_name": "3GPP Timed Text subtitle",
                "profile": "",
                "codec_type": "subtitle",
                "width": 1280,
                "height": 720,
                "duration": "45.446000",
                "nb_frames": "13",
                "disposition": {
                    "default": 1
                },
                "tags": {
                    "creation_time": ""
                }
            }
        ],
        "format": {
            "filename": "http://mydomain.ltd/SampleVideo.mp4",
            "duration": "45.446000",
            "size": "10181336",
            "bit_rate": "1792252",
            "probe_score": 100,
            "tags": []
        }
    },
    "requestId": {
        "$oid": "564c6277e1382316cc15ff64"
    },
    "duration": 45.4454,
    "nb_frames": 1362
}

Stats of a video

returns statistics of a video

Request:

GET http://api.qmery.com/v1/videos/[videoHashId]/stats.json?api_token=xxxxxxxxxx

Response:

{

}

Uploading a video

it's only available with api_token. must submit a form to http://api.qmery.com/v1/videos.json?api_token=xxxxxxxxxxx with POST method and multipart/form-data enctype

Request:

Parameter Type Description Requirement
video file Uploaded file of video Required if url is empty
title text title of video Optional. Defaults to No title
group_id text category id to upload Required
user_id text User id to store in DB for developer usage Optional
autostart bool if sent will set to play video automaticly Optional
hls bool if sent the video will be served in adaptive format Optional
url text URL of video Optional
callback_url text Post a response to your callback_url when video encode is done Optional
output_resolutions text An array of resolutions to convert video to ["640:480","244:128"] If does not pass to the api it will find the video size automatically Optional
Your logo setting Optional
logo_url text url of the image to put on the video Optional
logo_size text size of the logo in w:h format Required is logo_url is not empty.Defaults to 10:10
logo_position text Offset from top and left of video to put logo if the x:y format Required is logo_url is not empty.Defaults to 10:10
Image overlays An array to create image overlays from with the format of bottom [{url:"http://mydomain.ltd/image.png", size:"100:100", position:"20:20"}, ...] Optional
url text URL of the picture (currently PNG and JPG are supported)
size text Size of the image in w:h format
position text Position of the image in x:y format
Text overlays An array to create image overlays from with the format of bottom [{value:"Lorem Ipsum", size:18, position:"20:20",color:"#000000"}, ...] Optional
value text Text to put on video
size int Size of the font (Defaults to 18)
position text Position of the text in x:y format
color text Color of text overlay in hexadecimal RGB type

Response:

Video details as described in Viewing a video with a 201 Created header

Subtitles

Subtitles are the SRT files which will be seen on the player softcoded and choosable by users the list of them is available in Video object mentioned earlier

Adding a subtitle

Adding a subtitle file to subtitle

Request:

POST http://api.qmery.com/v1/videos/[videoHashId]/subtitle.json?api_token=xxxxxxxxxx

Parameter Type Description Requirement
file file Uploaded file of subtitle Required
name text title of subtitle to be shown as the name Required

Reponse: 201 Created header and the name of created subtitle

Deleting a subtitle

if you have subtitles with the same name it removes them all

Request:

DELETE http://api.qmery.com/v1/videos/[videoHashId]/subtitle.json?api_token=xxxxxxxxxx

Parameter Type Description Requirement
name text title of subtitle to be shown as the name Required

Reponse: 200 OK header

Thumbnails

Adding a thumbmail

Adding a thumbnail file to video

Request:

POST http://api.qmery.com/v1/videos/[videoHashId]/thumbnail.json?api_token=xxxxxxxxxx

Parameter Type Description Requirement
file file Uploaded file of thumbnail Required
default int set the uploaded thumbnail to the video`s default thumbnail Optional

Reponse: 201 Created header and the index of created thumbnail

Deleting a thumbnail

Request:

DELETE http://api.qmery.com/v1/videos/[videoHashId]/thumbnail.json?api_token=xxxxxxxxxx

Parameter Type Description Requirement
index int or array index or array of indexes to be deleted Required

Reponse: 200 OK header and the new list of thumbnails array

Set a thumbnail

Request:

PUT http://api.qmery.com/v1/videos/[videoHashId]/thumbnail.json?api_token=xxxxxxxxxx

Parameter Type Description Requirement
index int index of thumbnail to be set to default Required

Reponse: 200 OK header

Playlists

Playlists are objects which contain videos and will be played in a player

Methods

  • List playlists
  • View a certain playlist
  • Update a playlist
  • Delete a playlist
  • Add a playslist

List playlists

Request:

GET http://api.qmery.com/v1/playlists.json?api_token=xxxxxxxxxx

Response:

[
    {
        "id": 646,
        "title": "Some title",
        "hash_id": "2M8A7OkveoWev4Zg",
        "description": "",
        "video_count": 9,
        "create_date": 1428382771,
        "last_modified": 1428382771
    },
    {
        "id": 611,
        "title": "Another title",
        "hash_id": "od2z7BpKYok3gxvN",
        "description": "",
        "video_count": 0,
        "create_date": 1425973490,
        "last_modified": 1425973490
    },
]

View a playlist

Request:

GET http://api.qmery.com/v1/playlists/[playlistHashId].json?api_token=xxxxxxxxxx

Response:

{
    "id": 494,
    "title": "jigsaw9017",
    "hash_id": "z9MeyJqwPZp4QXmx",
    "description": "1234",
    "video_count": 4,
    "create_date": 1422088165,
    "last_modified": 1422088165,
    "videos": [
        {
            "id": 2071,
            "title": "",
            "description": "",
            "vastTag" : "",
            "viewed": 0,
            "length": 85,
            "userId": 123,
            "status": "not ready",
            "group_id": 494,
            "subtitles": [
            {
                "title": "\u0628\u062f\u0648\u0646 \u0646\u0627\u0645",
                "file": "http://storage.qmery.com/repository/9/55fd4f9ae7539.srt"
            },
            {
                "title": "\u0628\u062f\u0648\u0646 \u0646\u0627\u0645",
                "file": "http://storage.qmery.com/repository/9/55fd4fbc9b4a9.srt"
            }
        ],
            "video_quality": [
                {
                    "name": "256x144",
                    "width": 256,
                    "height": 144
                }
            ],
            "link": [],
            "thumbnail": [],
            "create_date": 1422090431,
            "modified_date": 1422090431
        },
        {
            "id": 2074,
            "title": "",
            "description": "",
            "viewed": 0,
            "length": 85,
            "userId": 123,
            "status": "not ready",
            "group_id": 494,
            "video_quality": [
                {
                    "name": "256x144",
                    "width": 256,
                    "height": 144
                }
            ],
            "link": [],
            "thumbnail": [],
            "create_date": 1422090877,
            "modified_date": 1422090877
        }
    ]
}

Updating a playlist

Request:

PUT http://api.qmery.com/v1/playlists/[playlistHashId].json?api_token=xxxxxxxxxx

Parameter Description
title Title of the playlist
description Description of the playlist
videos an array of video Ids.['82673' ,'123',...] are the available variables

Response:

if the playlist has been updated the API will response with a 200 OK status code and the location to the updated playlist in Location HTTP header and a playlist updated response text. the video ids that do not belong to you will not be added to the playlist

Deleting a Playlist

Request:

DELETE http://api.qmery.com/v1/playlists/[playlistHashId].json?api_token=xxxxxxxxxx

Response:

if the playlist has been deleted the API will response with a 200 OK status code and the playlist details as described in Viewing a playlist. Will return a 404 Not Found status code with playlist was not found message if the playlist is not found and/or does not belong to this user

Add a playlist

Request:

POST http://api.qmery.com/v1/playlists.json?api_token=xxxxxxxxxx

Parameter Description
title Title of the playlist
description Description of the playlist
videos an array of video Ids.['82673' ,'123',...] are the available variables

Response: a 201 Created code with the body of created playlist the video ids that do not belong to you will not be added to the playlist