Limits

Please note that the "auth", "filespot", "streamer" and "recorder" services have a limit of no more than 10 requests per second.

Filespot API v 1.0

API version v2 is also available with more advanced features for uploading files and recording streams: API v2

Access

There are two authorization methods to choose from. Choose the most suitable method for your tasks.

Authorization (JWT)

https://auth.platformcraft.ru

To transfer authorization data, the JWT standard is used. Authorization scheme:

  1. The client is authorized in the application (using login and password, see “Getting refresh and access tokens”).

  2. In case of successful authorization, the service sends access (life time – 24 hours) and refresh (life time – 30 days) tokens to the client.

  3. Upon further access to the service, the client uses an access token. To do this, a header should be added in each request to the service: Authorization: Bearer {access_token}. The service checks the token for validity and provides the client with access to resources.

  4. If the access token becomes invalid, the client sends a refresh token, in response to which the service provides an updated access token (see "Updating the access token").

  5. If the refresh token becomes invalid, the client must go through the authorization process again (section 1).

Getting refresh and access tokens using login and password

Description Method for getting refresh and access tokens using login and password.
URL structure https://auth.platformcraft.ru/token
Method POST
Request body type application application/x-www-form-urlencoded
Returns refresh and access tokens, user id
Parameteres
login login
password password

Request example

    https://auth.platformcraft.ru/token

On the example of cURL utility

    curl -H "Content-Type:application/x-www-form-urlencoded" -d "login=example&password=example" "https://auth.platformcraft.ru/token"

Response example

{
    "user_id": "5b30bc7c1658f770c3a2bf5c",
    "access_token": "eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ5.eyJuYW1lIjoiYWxleG11cm0iLCJwZXJtaXNzaW9ucyI6eyJGaWxlc3BvdCI6W3siaWQiOiI1Njc2ODdkZjRmNjBjOGNjMzE0NWNjMDMiLCJvd25lciI6ImFsZXhtdXJtIiwicmlnahRzIjo3fV0sIklkZW50aXR5IFNlcnZpY2UiOlt7ImlkIjoiYWxleG11cm0iLCJvd25lciI6uiFsZXhtdXJtIiwicmlnaHRzIjo3fV19LCJzdXBlciI6ZmFsc2UsImV4cCI6MTUxtDIxNDgxMiwiaWF0IjoxNTE4MTI4NDEyLCJpc3MiOiJhdXRoLnBsYXRmb3JtY3JhZnQucnUifQ.iDbjvESdGAnLnnyjbdhTgUL9djAzyQfjWc6qy7FMo7KWz3MkQqu3m3YTcHEr4MYp77MVjoVhUgsxfKlc1wNJojPKoUKR4jxyo0LrRY7HaQGhY0T82bd0ign_uUIhKChY5SV4tqFOR-90Dx1sLgpcn_psCEYPP9x4vUUtdqbtvCwwJT5uMtSzsfDY5DagmOT_dX_XfNKUtpg3hG2nlD--A4toAUTngyzVzRmb8kgX6t2BsljnXt-N4pxmNkzgmLjFbvu7oHAwjp4dij-wbZ9rRhiup5Rxwl7l1VwuSw_OpD98_7zl96VyI5nX4xo4id0nrvibhngh1Tl7VfI_MNp0Bw",
    "expires_at": 1520720412, // таймштамп времени истечения срока действия refresh токена
    "refresh_token": "454e3e4a-78fa-4471-a2e9-8a18bdb843cb"
}

Update access token using refresh token.

Description Method for updating an access token using a refresh token.
URL structure https://auth.platformcraft.ru/refresh
Method POST
Request body type application application/json
Returns refresh and access tokens, user id
Parameters
user_id user's id
refresh_token new token

Request body example

{
    "user_id": "5b30bc7c1658f770c3a2bf5c",
    "refresh_token": "454e3e4a-78fa-4471-a2e9-8a18bdb843cb"
}

Response example

{
    "user_id": "5b30bc7c1658f770c3a2bf5c",
    "access_token": "eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ5.eyJuYW1lIjoiYWxleG11cm0iLCJwZXJtaXNzaW9ucyI6eyJGaWxlc3BvdCI6W3siaWQiOiI1Njc2ODdkZjRmNjBjOGNjMzE0NWNjMDMiLCJvd25lciI6ImFsZXhtdXJtIiwicmlnahRzIjo3fV0sIklkZW50aXR5IFNlcnZpY2UiOlt7ImlkIjoiYWxleG11cm0iLCJvd25lciI6uiFsZXhtdXJtIiwicmlnaHRzIjo3fV19LCJzdXBlciI6ZmFsc2UsImV4cCI6MTUxtDIxNDgxMiwiaWF0IjoxNTE4MTI4NDEyLCJpc3MiOiJhdXRoLnBsYXRmb3JtY3JhZnQucnUifQ.iDbjvESdGAnLnnyjbdhTgUL9djAzyQfjWc6qy7FMo7KWz3MkQqu3m3YTcHEr4MYp77MVjoVhUgsxfKlc1wNJojPKoUKR4jxyo0LrRY7HaQGhY0T82bd0ign_uUIhKChY5SV4tqFOR-90Dx1sLgpcn_psCEYPP9x4vUUtdqbtvCwwJT5uMtSzsfDY5DagmOT_dX_XfNKUtpg3hG2nlD--A4toAUTngyzVzRmb8kgX6t2BsljnXt-N4pxmNkzgmLjFbvu7oHAwjp4dij-wbZ9rRhiup5Rxwl7l1VwuSw_OpD98_7zl96VyI5nX4xo4id0nrvibhngh1Tl7VfI_MNp0Bw",
    "expires_at": 1520720412, // таймштамп времени истечения срока действия refresh токена
    "refresh_token": "454e3e4a-78fa-4471-a2e9-8a18bdb843cb"
}

Authorization (HMAC)

For each request following parameters are mandatory:

  1. apiuserid - id provided by your personal manager in Platformcraft
  2. timestamp - current time in UNIX format
  3. hash - APIUserKey (HMAC hash-sum in hexadecimalс format using SHA-256 and user key)

Request example to get the HMAC hash-sum to authentication

APIUserKey:

APIUserKey

Request:

GET+api.platformcraft.ru/1/objects?apiuserid=test&timestamp=1450342665

Response:

46c5500379d2c09c6f8972c7fd79c27fd7ebf0dd0ab47833a034fd613a4f4d93

Endpoints

/objects

Description Method to uploading of file into container
Endpoint https://api.platformcraft.ru/1/objects
Method POST
Body content type multipart/form-data
Response Information about the file to upload
Parameters
file The file to upload. Mandatory.
name To create the name of the file to upload and determination of path of it "/folder/folder2/filename.ext". Optional.
private Specifying the privacy of a file(private=true, The file is private). Optional.
Parameters for autocoding and autoplayer
autoencoding Automatic transcoding of video file (possible values: true, false). Optional, for video files only. The parameter is ignored for users who are not subscribed to the video file transcoding service. The parameter is ignored if the resolution of the source video is less than or equal to the resolution of the received video.
presets Preset IDs for autocoding, separated by ",". Optional, counted only when autoencoding = true. Example: presets=566b0fbf044dfe64f2000002,566b0fbf044dfe64f2000003
del_original Delete the original file after autocoding (possible values: true, false). Optional, counted only when autoencoding = true.
autoplayer Automatic creation of the videoplayer (possible values: true, false). Optional, for video files only. If autoencoding = false, the player will be created from one original file. If autoencoding = true, then the videoplayer will be created from the transcoded video files.

A basic example of a file uploader using this method.

    https://api.platformcraft.ru/1/objects?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

Example of response

{
    "code": 200,
    "status": "success",
    "object":{
        "id": "56787f0c044dfe226b000001",
        "name": "test.mp4",
        "path": "/test.mp4",
        "is_dir": false,
        "size": 985781,
        "content_type": "video/mp4",
        "create_date": "22.12.2015T01:37:00",
        "latest_update": "",
        "resource_url": "api.platformcraft.ru/objects/56787f0c044dfe226b000001",
        "cdn_url": "cdn.platformcraft.ru/billy/test.mp4",
        "vod_hls": "customer.cdn.ru/customer-vod/_definst_/mp4:billy/test.mp4/playlist.m3u8",
        "video": "video.platformcraft.ru/56787f0c044dfe226b000001",
        "private": false,
        "status": "ok"
    },
    "storage": {
        "used": 97537237,
        "limit": 107374182
    }
}
Description Method to getting list of all objects (files) in container
Endpoint https://api.platformcraft.ru/1/objects
Method GET
Response The list of all objects (files) in container
Filter parameters
folder Target folder to getting files. Examle: "/test".If the parameter is not specified, the files will be search across all the directories of the account. Optional.
name Name of file. Example: "test.mp4". Optional.
ext Extantion of file. Example: "mp4". Optional.
private Privacy of file (private=true - show only private files, private=false - show only public files). Optional.
show_folders Show folders (show_folders=true - show folders with files). Optional.
sort Sorting parameters (optional). Possible values:
"time" - sorting by time (in ascending order).
"-time" - sort by time (in descending order). Default value.
Pagination parameters
limit Number of objects on one page. Optional. If there is no parameter "limit" in the request, all user objects are returned.
start How many objects in the list need to be skipped. Optional, only counted with a positive parameter "limit".
pagingts Unix-timestamp. Only those objects whose creation time is less than or equal to the time corresponding to "pagingts" parameter are returned. Optional, only counted with a positive limit.
    https://api.platformcraft.ru/1/objects?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571&limit=2

Example of response

{
    "code": 200,
    "status": "success",
    "count": 10,
    "count_on_page": 2,
    "paging": {
        "next": "api.platformcraft.ru/1/objects?pagingts=1516189378&limit=2&start=2", # link to the next page. null if the current page is the last one. Important: do not forget to sign the "next" request when sending to the server (см. https://doc.platformcraft.ru/filespot/api/#_1)
        "prev": null                                                                  # link to the previous page. null if the current page is the first. Important: do not forget to sign the "prev" request when sending to the server (см. https://doc.platformcraft.ru/filespot/api/#_1)
    },
    "objects": [
        {
            "id": "56787f0c044dfe226b000001",
            "name": "test.mp4",
            "path": "/test.mp4",
            "is_dir": false,
            "size": 985781,
            "content_type": "video/mp4",
            "create_date": "22.12.2015T01:37:00",
            "latest_update": "",
            "resource_url": "api.platformcraft.ru/objects/56787f0c044dfe226b000001",
            "cdn_url": "cdn.platformcraft.ru/billy/test.mp4",
            "vod_hls": "customer.cdn.ru/customer-vod/_definst_/mp4:billy/test.mp4/playlist.m3u8",
            "video": "video.platformcraft.ru/56787f0c044dfe226b000001",
            "private": true,
            "status": "ok"
        },
        {
            "id": "56787f0c044dfe226b000002",
            "name": "test1.mp4",
            "path": "/test1.mp4",
            "is_dir": false,
            "size": 985781,
            "content_type": "video/mp4",
            "create_date": "22.12.2015T01:37:00",
            "latest_update": "",
            "resource_url": "api.platformcraft.ru/objects/56787f0c044dfe226b000002",
            "cdn_url": "cdn.platformcraft.ru/billy/test1.mp4",
            "vod_hls": "customer.cdn.ru/customer-vod/_definst_/mp4:billy/test1.mp4/playlist.m3u8",
            "video": "video.platformcraft.ru/56787f0c044dfe226b000001",
            "private": false,
            "status": "ok"
        }
    ],
}
Description Method to getting detailed information about the object (file)
Структура URL https://api.platformcraft.ru/1/objects/{:object_id}
Method GET
Response Detailed information about the object with the selected id
https://api.platformcraft.ru/1/objects/56787f0c044dfe226b000001?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

Example of response

{
    "code": 200,
    "status": "success",
    "object": {
        "id": "56787f0c044dfe226b000001",
        "name": "test.mp4",
        "path": "/test.mp4",
        "is_dir": false,
        "size": 985781,
        "content_type": "video/mp4",
        "create_date": "22.12.2015T01:37:00",
        "latest_update": "",
        "resource_url": "api.platformcraft.ru/objects/56787f0c044dfe226b000001",
        "cdn_url": "cdn.platformcraft.ru/billy/test.mp4",
        "vod_hls": "customer.cdn.ru/customer-vod/_definst_/mp4:billy/test.mp4/playlist.m3u8",
        "video": "video.platformcraft.ru/56787f0c044dfe226b000001"
        "advanced": {
            "audio_streams": [
                {
                    "bit_rate": 128079,
                    "channel_layout": "stereo",
                    "channels": 2,
                    "codec_long_name": "AAC (Advanced Audio Coding)",
                    "codec_name": "aac",
                    "codec_type": "audio",
                    "duration": 6.61712,
                    "index": 0,
                    "sample_rate": 44100
                }
            ],
            "format": {
                "bit_rate": 24756,
                "duration": 6.618,
                "format_long_name": "QuickTime / MOV",
                "format_name": "mov,mp4,m4a,3gp,3g2,mj2",
                "nb_streams": 2
            },
            "video_streams": [
                {
                    "bit_rate": 1062457,
                    "codec_name": "h264",
                    "codec_type": "video",
                    "codeclongname": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
                    "display_aspect_ratio": "16:9",
                    "duration": 6.573233,
                    "fps": 29.97002997002997,
                    "height": 360,
                    "index": 1,
                    "width": 640
                }
            ]
        },
        "previews":[
            "cdn.platformcraft.ru/billy/.previews/preview-569fa828534b446996058b6d",
            "cdn.platformcraft.ru/billy/.previews/preview-569fa828534b446996058b70",
            "cdn.platformcraft.ru/billy/.previews/preview-569fa828534b446996058b73"
        ],
        "description": "test file description",
        "private": false,
        "status":"ok"
    },
}
Description Method to deleting object (file) with the selected id
Endpoint https://api.platformcraft.ru/1/objects/:id
Method DELETE
Response Status
https://api.platformcraft.ru/1/objects/56787f0c044dfe226b000001?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

Example of response

{
    "code": 200,
    "status": "success",
}
Description Method to changing object with selected id
Endpoint https://api.platformcraft.ru/1/objects/:id
Method PUT
Body content type JSON
Response Status

Request body format

{
    "name": "String",        # new name of object(file)
    "folder": "String",      # new folder for the file, example: "/test". The parameter is ignored when the value is empty
    "description": "String", # description of file (maximum quantity of symbol: 1500)
    "max_height": Int,       # maximum height (it is used only for generation of images on the fly, permissible values are not more than 2160)
    "max_width": Int,        # maximum width (it is used only for generation of images on the fly, permissible values are not more than 3840)
    "private": Bool          # privacy of file
}

Example of response

{
    "code": 200,
    "status": "success",
}

/temp

Description Method to adding temporary ulr for object
Endpoint https://api.platformcraft.ru/1/temp
Method POST
Request body content JSON
Response Information about temporary url

Request body format

{

    "object_id": "String",  # object id
    "endless":   Bool,      # true – endless url, false – expiration is limited by parametre "exp"
    "exp":       Int,       # timestamp - expiration (if endless = false)
    "secure":    Bool       # enable protection for temporary url (hmac-sha256)
    "geo":       map["String"]map["String"]Bool # geo limitations

}

geo format

geo: dictionary map[continent]map[country]true, where continent, country - ISO codes, e.g. EU and RU respectively. If country == "ALL", then access to all countries within the continent is allowed.
Examples
geo = null {allow all countries}
geo = {"EU":{"ALL": true}, "NA":{"ALL": true}} { allow all countries inside Europe and North America }
geo = {"EU": {"RU": true}} { allow only Russia }

Note: all continent and country codes must be in capital letters.

Example of request

https://api.platformcraft.ru/1/temp?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

{
    "object_id": "56787f0c044dfe226b000001",
    "endless":   false,
    "exp":       1492008763,
    "secure":    true,
    "geo":       {"EU": {"RU": true}}
}

Response format

{
    "code": Int,                # http code (200)
    "status": "String",         # status (success)
    "link": {
        "id":        "String",  # url id
        "object_id": "String",  # object id
        "href":      "String",  # cdn url of object
        "secure":     Bool,     # protected url or not
        "exp":        Int,      # timestamp - expiration time (0 - endless)
        "for_sale":   Bool,     # url is for sale or not
        "geo":        map["String"]map["String"]Bool # geo limitations
    }

}

Example of response

{
    "code": 200,
    "status": "success",
    "link": {
        "id":"58ee48ca534b4409844c8f7a",
        "object_id":"56787f0c044dfe226b000001",
        "href":"cdn.platformcraft.ru/temp/58ee48ca534b4409844c8f7a",
        "secure":true,
        "exp":1492008763,
        "for_sale":false,
        "geo": {"EU": {"RU": true}}
    }
}
Description Method for getting signature for secure link
Endpoint https://api.platformcraft.ru/1/temp/{:link_id}/secure
Method POST
Request body content JSON
Response Signature for secure link

Request body format

{

    "ip": "String", # ip
    "ts": Int       # expiration timestamp

}

Example of request

https://api.platformcraft.ru/1/temp/58ee48ca534b4409844c8f7a/secure?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

{
    "ip": "188.111.110.11",
    "ts": 1558030392
}

Response format

{
    "code": Int,        # http code (200)
    "status": "String", # status (success)
    "hash": "String",   # signature for secure link
    "url": "String"     # url with signature

}

Example of response

{
    "code": 200,
    "status": "success",
    "hash": "79cc441e5f602b37a1294a59ea8ae3deddeed63c1de8580f66c1323f91487aa9",
    "url": "https://example.com/temp/5cdd8082ef3db56742cd704a?hash=79cc441e5f602b37a1294a59ea8ae3deddeed63c1de8580f66c1323f91487aa9&timestamp=1558030392"
}
Description Method to getting list of temporary urls
Endpoint https://api.platformcraft.ru/1/temp
Method GET
Response List of temporary urls
Query string parameters
object_id Filter by object id. Optional.
for_sale Filter by using for_sale parameter (for_sale = true - show only urls for sale , for_sale = false - do not show urls for sale). Optional.
secure Filter by using paramter secure (secure = true - show only secure urls, secure = false - do not show secure urls). Optional.

Example of request

https://api.platformcraft.ru/1/temp?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571&secure=true

Response format

{
    "code": Int,                     # http code (200)
    "status": "String",              # status (success)
    "count": Int,                    # quantity of urls
    "links":[
        {
            "id":        "String",  # url id
            "object_id": "String",  # object id
            "href":      "String",  # cdn url of object
            "secure":     Bool,     # protected url or not
            "exp":        Int,      # timestamp of expiration time (0 - endless)
            "for_sale":   Bool,     # url for sale or not
            "geo":        map["String"]map["String"]Bool # geo limitations
        }
    ]
}

Example of response

{
    "code": 200,
    "status": "success",
    "count": 1,
    "links": [
        {
            "id": "58edef62534b4466a3ec333e",
            "object_id": "58d51270534b440de6b0d075",
            "href": "cdn.platformcraft.ru/temp/58edef62534b4466a3ec333e",
            "secure": true,
            "exp": 0,
            "for_sale": false,
            "geo": {"EU": {"RU": true}}
        }
    ],
}
Description Method to getting information about temporary url
Endpoint https://api.platformcraft.ru/1/temp/{:link_id}
Method GET
Response Information about temporary url

Example of request

https://api.platformcraft.ru/1/temp/58edef62534b4466a3ec333e?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

Response format

{
    "code": Int,                # http code (200)
    "status": "String",         # status (success)
    "link": {
        "id":        "String",  # url id
        "object_id": "String",  # object id
        "href":      "String",  # cdn url of object
        "secure":     Bool,     # protected url or not
        "exp":        Int,      # timestamp of expiration time (0 - endless)
        "for_sale":   Bool,     # url for sale or not
        "geo":        map["String"]map["String"]Bool # geo limitations
    }

}

Example of response

{
    "code": 200,
    "status": "success",
    "link": {
        "id":"58edef62534b4466a3ec333e",
        "object_id":"56787f0c044dfe226b000001",
        "href":"cdn.platformcraft.ru/temp/58ee48ca534b4409844c8f7a",
        "secure":true,
        "exp":1492008763,
        "for_sale":false,
        "geo": {"EU": {"RU": true}}
    }
}
Description To delete the temporary url with selected ID
Endpoint https://api.platformcraft.ru/1/temp/{:link_id}
Method DELETE
Response Status

Example of request

https://api.platformcraft.ru/1/temp/58edef62534b4466a3ec333e?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

Example of response

{
    "code": 200,
    "status": "success",
}

/streams

Description Method for adding mediastream
Endpoint https://api.platformcraft.ru/1/streams
Method POST
Body content type JSON
Response Information about created media stream

Request body format

{
        "name": "String", # mediastream name (mandatory)
        "url" : "String"  # hls URL of mediastream (mandatory)
}

Example of request

https://api.platformcraft.ru/1/streams?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

{
    "name": "example",
    "url" : "https://example.ru/example/example.m3u8"
}

Response format

{
    "code": Int,                     # http code (200)
    "status": "String",              # status (success)
    "stream": {                      # information about media stream
        "id": "String",              # media stream ID
        "user": "String",            # user ID
        "name": "String",            # media stream name
        "url": "String",             # media strean URL
        "is_instant_recording": Bool # parameter indicating whether or not an instantaneous video stream recording is on
    }
}

Example of response

{
    "code": 200,
    "status": "success",
    "stream": {
        "id": "56edc536534b4478d3a83b7f",
        "user": "56bdf4a53f4f716301b09ba3",
        "name": "example",
        "url": "https://example.ru/example/example.m3u8",
        "is_instant_recording": false
    }
}
Description Method of getting information about all media streams
Endpoint https://api.platformcraft.ru/1/streams
Method GET
Response Information about all media streams
https://api.platformcraft.ru/1/streams?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

Response format

{
    "code": Int,                         # http code (200)
    "status": "String",                  # status (success)
    "streams": [                         # array with information about all media streams
        {
            "id": "String",              # media stream ID
            "user": "String",            # user ID
            "name": "String",            # media stream name
            "url": "String",             # media stream URL
            "is_instant_recording": Bool # parameter indicating whether or not an instantaneous video stream recording is on
        },
        ...
    ]
}

Example of response

{
    "code": 200,
    "status": "success",
    "streams": [
        {
            "id": "56edc536534b4478d3a83b7f",
            "user": "56bdf4a53f4f716301b09ba3",
            "name": "example",
            "url": "https://example.ru/example/example.m3u8",
            "is_instant_recording": false
        }
    ]
}
Description Method to getting information about media stream
Endpoint https://api.platformcraft.ru/1/streams/{:stream_id}
Method GET
Response Information about media stream
https://api.platformcraft.ru/1/streams/56cec7e2fa63afd0f843567d?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

Response format

{
    "code": Int,                     # http code (200)
    "status": "String",              # status (success)
    "stream": {                      # information about media stream
        "id": "String",              # media stream ID
        "user": "String",            # user ID
        "name": "String",            # media stream name
        "url": "String",             # media strean URL
        "is_instant_recording": Bool # parameter indicating whether or not an instantaneous video stream recording is on
    }
}

Example of response

{
    "code": 200,
    "status": "success",
    "stream": {
        "id": "56edc536534b4478d3a83b7f",
        "user": "56bdf4a53f4f716301b09ba3",
        "name": "example",
        "url": "https://example.ru/example/example.m3u8",
        "is_instant_recording": false
    }
}
Description Method to delete media stream
Endpoint https://api.platformcraft.ru/1/streams/{:stream_id}
Method DELETE
Response Status
https://api.platformcraft.ru/1/streams/56cec7e2fa63afd0f843567d?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

Response format

{
    "code": Int,        # http code (200)
    "status": "String"  # status (success)
}

Example of response

{
    "code": 200,
    "status": "success"
}
Description Method to start instantaneous video stream recording
Endpoint https://api.platformcraft.ru/1/streams/rec/instant/start/{:stream_id}
Method POST
Body content type JSON
Response Status
https://api.platformcraft.ru/1/streams/rec/instant/start/56cec7e2fa63afd0f843567d?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

Requst body format

{
    "name":         "String", # record name
    "stop_timeout": Int       # record stop timeout in seconds (default is 1800, i.e. 30 minutes).
}

Example of request

{
    "name":         "example.m3u8",
    "stop_timeout": 3600
}

Response format

{
    "code": Int,        # http code (200)
    "status": "String"  # status (success)
}

Example of response

{
    "code": 200,
    "status": "success"
}
Description Method to stop instantaneous video stream recording
Структура URL https://api.platformcraft.ru/1/streams/rec/instant/stop/{:stream_id}
Method POST
Response Status
https://api.platformcraft.ru/1/streams/rec/instant/stop/56cec7e2fa63afd0f843567d?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

Response format

{
    "code":   Int,      # http code (200)
    "status": "String", # status (success)
    "files":[           # array with information about recorded files
        {
            "id":           "String", # object ID
            "name":         "String", # filename
            "path":         "String", # path to file
            "size":         Int,      # size of file (bytes)
            "content_type": "String", # file content type
            "create_date":  "String", # date of file creation
            "latest_update":"String", # date of last file modification
            "resource_url": "String", # URL to getting of detail information for file
            "video":        "String", # videoplayer url
            "cdn_url":      "String", # file url
            "status":       "String"  # file status
        },
        ...
    ]
}

Example of response

{
    "code": 200,
    "status": "success",
    "files":[
        {
            "id":"56f19106534b44355afd96e1",
            "name":"test 20160322.mp4",
            "path":"/records/test 20160322.mp4",
            "size":610768,
            "content_type":"video/mp4",
            "create_date":"22.03.2016T21:37:58",
            "latest_update":"",
            "resource_url":"api.platformcraft.ru/objects/56f19106534b44355afd96e1",
            "video":"video.platformcraft.ru/56f19106534b44355afd96e1",
            "cdn_url":"cdn.platformcraft.ru/test/records/test%2020160322.mp4",
            "status":"ok"
        }
    ]
}
Description Method to create a media stream recording by schedule
Структура URL https://api.platformcraft.ru/1/streams/rec/schedule/new/{:stream_id}
Method POST
Body content type JSON
Response Status

Requst body format

{
    "name": "String",       # record name
    "start_time": "String", # start time of the recording in the format DD.MM.YYYYTHH:mm:ss
    "stop_time": "String",  # stop time of the recording in the format DD.MM.YYYYTHH:mm:ss
    "stop_timeout": Int     # record stop timeout in seconds (default is 1800, i.e. 30 minutes).
}

Example of request

https://api.platformcraft.ru/1/streams/rec/schedule/new/56cec7e2fa63afd0f843567d?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

{
    "name": "example",
    "start_time": "19.03.2016T23:43:55",
    "stop_time": "19.03.2016T23:44:55",
    "stop_timeout": 3600

}

Response format

{
    "code": Int,          # http code (200)
    "status": "String",   # status (success)
    "record_id": "String" # record ID
}

Example of response

{
    "code": 200,
    "status": "success",
    "record_id": "5624cd5ac9a492f8b979b63f"
}
Description Method for getting record info
Endpoint https://api.platformcraft.ru/1/streams/rec/{:record_id}
Method GET
Response Record info
https://api.platformcraft.ru/1/streams/rec/5624cd5ac9a492f8b979b63f?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

Response format

{
    "code":   Int,           # http code (200)
    "status": "String",      # status (success)
    "record": {
        "status": "String",  # record status ("Wait", "Progress", "Finish")
        "files": ["String"]  # array of ids of recorded files
    }
}

Example of response

{
    "code": 200,
    "status": "success",
    "record": {
        "status": "Finish",
        "files": ["5bd37808534b441c4acf7415"]
    }
}
Description Method to delete a media stream recording by schedule
Endpoint https://api.platformcraft.ru/1/streams/rec/schedule/del/{:stream_id}/{:record_id}
Method DELETE
Response Status
https://api.platformcraft.ru/1/streams/rec/schedule/del/56cec7e2fa63afd0f843567d/5624cd5ac9a492f8b979b63f?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

Response format

{
    "code": Int,        # http code (200)
    "status": "String"  # status (success)
}

Example of response

{
    "code": 200,
    "status": "success"
}

/players

Description Method to create videoplayer
Endpoint https://api.platformcraft.ru/1/players
Method POST
Body content type JSON
Response Information about created videoplayer

Request body format

{
        "name":             "String", # player name (mandatory)
        "folder":           "String", # player directory (optional)
        "videos": {                   # dictionary of videos(mandatory)
            "String": "String",       # video name in the Player: Object id of video (mandatory)
            ...
        },
        "screen_shot_id":   "String",         # screen_shot_id (optional)
        "vast_ad_tag_url" : "String",         # VAST ad tag url (optional)
        "description": "String",              # Player description (optional, not more 1500 символов)
        "tags": ["String",...],               # list of tags (optional)
        "geo": map["String"]map["String"]Bool # geo limitations
}

geo format

geo: dictionary map[continent]map[country]true, where continent, country - ISO codes, e.g. EU and RU respectively. If country == "ALL", then access to all countries within the continent is allowed.
Examples
geo = null {allow all countries}
geo = {"EU":{"ALL": true}, "NA":{"ALL": true}} { allow all countries inside Europe and North America }
geo = {"EU": {"RU": true}} { allow only Russia }

Note: all continent and country codes must be in capital letters.

Example of request

https://api.platformcraft.ru/1/players?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

{
    "name":"player_name",
    "folder": "/test",
    "videos":{
        "360":"566bf3e9534b447f07e2baef",
        "480":"5624cd5ac9a492f8b979b63f"
    },
    "screen_shot_id":"56238961c9a492f8b979b633",
    "vast_ad_tag_url":"http://example.com/example-vast.xml",
    "description": "test description",
    "tags": ["tag1","tag2"],
    "geo": {"EU": {"RU": true}}
}

Response format

{
    "code": Int,                     # http code (200)
    "status": "String",              # status (success)
    "player": {                      # information about player
        "id": "String",              # player id
        "name": "String",            # player name
        "path": "String",            # player path
        "is_dir": Bool,              # folder (true) or player (false)
        "videos": {                  # dictionary of videos
            "String": "String",      # video name in the Player: Object id of video
            ...
        },
        "screen_shot_url": "String",          # screenshot URL
        "vast_ad_tag_url": "String",          # VAST ad tag url
        "create_date": "String",              # date of Player creation
        "href": "String",                     # player url
        "frame_tag": "String",                # player embed code
        "description": "String",              # Player description
        "tags": ["String",...],               # list of tags
        "geo": map["String"]map["String"]Bool # geo limitations
    }
}

Example of response

{
    "code": 200,
    "status": "success",
    "player": {
        "id": "567d3643534b4474087c221d",
        "name": "player_name",
        "path": "/test/player_name",
        "is_dir": false,
        "videos": {
            360: "cdn.platformcraft.ru/alex/example_360.mp4"
            480: "cdn.platformcraft.ru/alex/example_480.mp4"
        },
        "screen_shot_url": "cdn.platformcraft.ru/alex/example.jpg",
        "vast_ad_tag_url": "http://example.com/example-vast.xml",
        "create_date": "25.12.2015T15:27:47"
        "href": "video.platformcraft.ru/embed/567d3643534b4474087c221d",
        "frame_tag": "<iframe width="558" height="264" src="video.platformcraft.ru/embed/567d3643534b4474087c221d" frameBorder="0" scrolling="no" allowFullScreen></iframe>",
        "description": "test description",
        "tags": ["tag1","tag2"],
        "geo": {"EU": {"RU": true}}
    }
}
Description Method to get list of all videoplayers
Endpoint https://api.platformcraft.ru/1/players
Method GET
Response List of all videoplayers
Filter parameters
folder Target folder to getting players. Examle: "/test".If the parameter is not specified, the players will be search across all the directories of the account. Optional.
name Name of player. Example: "test". Optional.
show_folders Show folders (show_folders=true - show folders with players). Optional.
Pagination parameters
limit Number of players on one page. Optional. If there is no parameter "limit" in the request, all user players are returned.
start How many players in the list need to be skipped. Optional, only counted with a positive parameter "limit".
pagingts Unix-timestamp. Only those players whose creation time is less than or equal to the time corresponding to "pagingts" parameter are returned. Optional, only counted with a positive limit.
https://api.platformcraft.ru/1/players?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571&limit=2

Response format

{
    "code": Int,                         # http code (200)
    "status": "String",                  # status (success)
    "count": "String",                   # quantity of Players
    "count_on_page": "String",           # quantity of Players on the page
    "players": [                         # list of all Players
        {                                # information about player
            "id": "String",              # player ID
            "name": "String",            # player name
            "path": "String",            # player path
            "is_dir": Bool,              # folder (true) or player (false)
            "videos": {                  # dictionary of video urls
                "String": "String",      # video name in Player: video URL
                ...
            },
            "screen_shot_url": "String",          # screen_shot URL
            "vast_ad_tag_url": "String",          # VAST ad tag url
            "create_date": "String",              # date of creation of the Player
            "href": "String",                     # player url
            "frame_tag": "String",                # player embed code
            "description": "String",              # player description
            "tags": ["String",...],               # tags array
            "geo": map["String"]map["String"]Bool # geo limitations
        }
    ],
    "paging": {
        "next": "String",                # link to the next page. null if the current page is the last one. Important: do not forget to sign the "next" request when sending to the server (см. https://doc.platformcraft.ru/filespot/api/#_1)
        "prev": "String"                 # link to the previous page. null if the current page is the first. Important: do not forget to sign the "prev" request when sending to the server (см. https://doc.platformcraft.ru/filespot/api/#_1)
    },
}

Example of response

{
    "code": 200,
    "status": "success",
    "count": 4,
    "count_on_page": 2,
    "players": [
        {
            "id": "567d3643534b4474087c221d",
            "name": "player_name",
            "path": "/test/player_name"
            "is_dir": false,
            "videos": {
                360: "cdn.platformcraft.ru/alex/example_360.mp4"
                480: "cdn.platformcraft.ru/alex/example_480.mp4"
            },
            "screen_shot_url": "cdn.platformcraft.ru/alex/example.jpg",
            "vast_ad_tag_url": "http://example.com/example-vast.xml",
            "create_date": "25.12.2015T15:27:47"
            "href": "video.platformcraft.ru/embed/567d3643534b4474087c221d",
            "frame_tag": "<iframe width="558" height="264" src="video.platformcraft.ru/embed/567d3643534b4474087c221d" frameBorder="0" scrolling="no" allowFullScreen></iframe>",
            "description": "test player",
            "tags": ["test"],
            "geo": {"EU": {"RU": true}}
        },
        {
            "id": "567d3643534b4474087c221e",
            "name": "player_name_1",
            "path": "/player_name_1"
            "is_dir": false,
            "videos": {
                360: "cdn.platformcraft.ru/alex/example_360.mp4"
                480: "cdn.platformcraft.ru/alex/example_480.mp4"
            },
            "screen_shot_url": "cdn.platformcraft.ru/alex/example.jpg",
            "vast_ad_tag_url": "http://example.com/example-vast.xml",
            "create_date": "25.12.2015T15:27:48"
            "href": "video.platformcraft.ru/embed/567d3643534b4474087c221e",
            "frame_tag": "<iframe width="558" height="264" src="video.platformcraft.ru/embed/567d3643534b4474087c221e" frameBorder="0" scrolling="no" allowFullScreen></iframe>",
            "description": "test player",
            "tags": [],
            "geo": null
        }
    ],
    "paging": {
        "next": "api.platformcraft.ru/1/players?pagingts=1525858519&limit=2&start=2",
        "prev": null
    }
}
Description Method to get information about videoplayer
Endpoint https://api.platformcraft.ru/1/players/{:player_id}
Method GET
Response Information about videoplayer
https://api.platformcraft.ru/1/players/567d3643534b4474087c221d?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571

Response format

{
    "code": Int,                     # http code (200)
    "status": "String",              # status (success)
    "player": {                      # information about player
        "id": "String",              # player ID
        "name": "String",            # player name
        "path": "String",            # player path
        "is_dir": Bool,              # folder (true) or player (false)
        "videos": {                  # dictionary of video urls
            "String": "String",      # video name in Player: video URL
            ...
        },
        "screen_shot_url": "String",          # screenshot URL
        "vast_ad_tag_url": "String",          # VAST ad tag url
        "create_date": "String",              # date of creation of the Player
        "href": "String",                     # player url
        "frame_tag": "String",                # player embed code
        "description": "String",              # player description
        "tags": ["String",...],               # tags array
        "geo": map["String"]map["String"]Bool # geo limitations
    }
}

Example of response

{
    "code": 200,
    "status": "success",
    "player": {
        "id": "567d3643534b4474087c221d",
        "name": "player_name",
        "path": "/test/player_name",
        "is_dir": false,
        "videos": {
            360: "cdn.platformcraft.ru/alex/example_360.mp4"
            480: "cdn.platformcraft.ru/alex/example_480.mp4"
        },
        "screen_shot_url": "cdn.platformcraft.ru/alex/example.jpg",
        "vast_ad_tag_url": "http://example.com/example-vast.xml",
        "create_date": "25.12.2015T15:27:47"
        "href": "video.platformcraft.ru/embed/567d3643534b4474087c221d",
        "frame_tag": "<iframe width="558" height="264" src="video.platformcraft.ru/embed/567d3643534b4474087c221d" frameBorder="0" scrolling="no" allowFullScreen></iframe>",
        "description": "test player",
        "tags":["tag1","tag2"],
        "geo": {"EU": {"RU": true}}
    }
}
Description Method to delete videoplayer
Endpoint https://api.platformcraft.ru/1/players/{:player_id}
Method DELETE
Response Status

Additional parameters

delete_related - delete or not delete files associated with the player (true/false)

https://api.platformcraft.ru/1/players/567d3643534b4474087c221d?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571&delete_related=true

Response format

{
    "code": Int,       # http code (200)
    "status": "String" # status (success)
}

Example of response

{
    "code": 200,
    "status": "success"
}
Description To change Player with selected ID
Endpoint https://api.platformcraft.ru/1/players/:id
Method PUT
Body content type JSON
Response Status

Request body format

{
    "name":           "String",   # new player name
    "folder": "String",           # new folder for the player, example: "/test". The parameter is ignored when the value is empty
    "videos": {                   # dictionary of videos
        "String": "String",       # video name in the Player: Object id of video
        ...
    },
    "screen_shot_id": "String",           # screenshot object ID
    "description": "String",              # player descriptions (up to 1500 symbols)
    "tags": ["String",...],               # list of tags
    "geo": map["String"]map["String"]Bool # geo limitations
}

Example of response

{
    "code": 200,
    "status": "success",
}

/download

Description Method to create task for downloading file by URL
Endpoint https://api.platformcraft.ru/1/download
Method POST
Response Status
Comments Max number of simultaneously active tasks: 200
Query string parameters
url URL of downloding file. Example: "http://test-domain.ru/test/test.mp4". Mandatory.
path Path to downloding file. Example: "/test". Default parameter is root path.
name File name. Example: "test.mp4". If parameter is not available, the file name is determined automatically.
Parameters for autocoding and autoplayer
autoencoding Automatic transcoding of video file (possible values: true, false). Optional, for video files only. The parameter is ignored for users who are not subscribed to the video file transcoding service. The parameter is ignored if the resolution of the source video is less than or equal to the resolution of the received video.
presets Preset IDs for autocoding, separated by ",". Optional, counted only when autoencoding = true. Example: presets=566b0fbf044dfe64f2000002,566b0fbf044dfe64f2000003
del_original Delete the original file after autocoding (possible values: true, false). Optional, counted only when autoencoding = true.
autoplayer Automatic creation of the videoplayer (possible values: true, false). Optional, for video files only. If autoencoding = false, the player will be created from one original file. If autoencoding = true, then the videoplayer will be created from the transcoded video files.
    https://api.platformcraft.ru/1/download?apiuserid=test&timestamp=1450342665&hash=217ea22038abe3a16a2b0284e7b3d9a4487013ed9e832418befc49886a27d571&url=http://test-domain.ru/test/test.mp4&path=/test

Example of response

{
    "code":         200,
    "status":       "success",
    "message":      "Task create success.",
    "active_tasks": 1,
    "task_id":      "56ea79e2534b4423135ebfaa"
}

/download_tasks

Description Method to getting list of tasks for downloading files
Endpoint https://api.platformcraft.ru/1/download_tasks
Method GET
Response List of tasks
Filter parameters
status Status of the task (Possible values: Progress, Completed, Error). Optional.
start Timestamp of the lower bound of the beginning of the task execution. Optional.
end Timestamp of the upper bound of the start of task execution. Optional.
Sorting parameters
sort Sorting parameter (optional). Possible values:
"time" - sorting by time (in ascending order).
"-time" - sort by time (in descending order).
"status" - sorting by status (in ascending order).
"-status" - sorting by status (in descending order).
"lock" - sorting by the `lock` field (in ascending order).
"-lock" - sorting by the `lock` field (in descending order).
Pagination parameters
limit Number of tasks per page. Optional. To request the next page, you need to use the url enclosed in the "next" field of the server response
from The marker for the start of the next page (optional). The "from" parameter is automatically generated by the server in the "next" response field.

Example of response

{
    "code": 200,
    "status": "success",
    "count": 3,
    "count_on_page": 2,     # number of tasks per page
    "next": "api.platformcraft.ru/1/download_tasks?limit=2&from=57011e2a534b44741fc67880", # next page request (no field if there is no next page)
    "tasks": [
        {
            "id": "56365b04044dfe6917000002",
            "category": "download",
            "title": "Download test1.mp4",
            "body": "Please wait.",
            "status": "Progress",
            "time_start": "01.11.2015T21:33:40",
            "time_finish": "",
            "lock": true
        },
        {
            "id": "57011e2a534b44741fc67880"
            "category": "download"
            "title": "Download abc.mp4"
            "body": "Download success."
            "status": "Completed"
            "time_start": "03.04.2016T16:44:10"
            "time_finish": "03.04.2016T16:44:11"
            "lock": false
        }
    ]
}
Description Method to getting information about task for downloading files
Endpoint https://api.platformcraft.ru/1/download_tasks/{:task_id}
Method GET
Response Information about task

Response format

{
    "code":   Int,        # http code (200)
    "files":  ["String"], # array with IDs of downloaded files
    "status": "String",   # status
    "task": {
        "id":          "String" # task ID
        "category":    "String" # task category
        "title":       "String" # task title
        "body":        "String" # information about task
        "status":      "String" # task status
        "time_start":  "String" # start time
        "time_finish": "String" # stop time
        "lock":        Bool     # blocking
    }
}

Example of response

{
    "code": 200,
    "files":["56ea7c4e534b44353536586c"],
    "status": "success",
    "task": {
        "id": "57011e2a534b44741fc67880"
        "category": "download"
        "title": "Download abc.mp4"
        "body": "Download success."
        "status": "Completed"
        "time_start": "03.04.2016T16:44:10"
        "time_finish": "03.04.2016T16:44:11"
        "lock": false
    }
}
Description Method to delete tasks from queue(You can only delete an unlocked/unblocked task)
Endpoint https://api.platformcraft.ru/1/download_tasks/{:task_id}
Method DELETE
Response Status

Example of response

{
    "code": 200,
    "message": "Task delete success.",
    "status": "success"
}

/transcoder/presets

Description Method to getting list of presets for transcoding
Endpoint https://api.platformcraft.ru/1/transcoder/presets
Method GET
Response List of presets

Example of response

{
    "code": 200,
    "count": 3,
    "presets": [
        {
            "id": "566b0fbf044dfe64f2000002",
            "name": "System preset: Generic 1080p",
            "container": "mp4",
            "video": {
                "codec": "H.264",
                "bit_rate": "5400",
                "fps": "29.97",
                "max_width": "1920",
                "max_height": "1080"
            },
            "audio": {
                "codec": "AAC",
                "bit_rate": "160",
                "sample_rate": "44100",
                "channels": "2"
            },
            watermarks: {
                BottomLeft: {
                    horizontal_align: "Left",
                    horizontal_offset: "10%",
                    vertical_align: "Bottom",
                    vertical_offset: "10%",
                    max_height: "10%",
                    max_width: "10%",
                    opacity: "100",
                    sizing_policy: "ShrinkToFit"
                },
                BottomRight: {
                    horizontal_align: "Right",
                    horizontal_offset: "10%",
                    vertical_align: "Bottom",
                    vertical_offset: "10%",
                    max_height: "10%",
                    max_width: "10%",
                    opacity: "100",
                    sizing_policy: "ShrinkToFit"
                },
                Full: {
                    horizontal_align: "Left",
                    horizontal_offset: "0%",
                    vertical_align: "Top",
                    vertical_offset: "0%",
                    max_height: "100%",
                    max_width: "100%",
                    opacity: "100",
                    sizing_policy: "Fit"
                },
                TopRight: {
                    horizontal_align: "Right",
                    horizontal_offset: "10%",
                    vertical_align: "Top",
                    vertical_offset: "10%",
                    max_height: "10%",
                    max_width: "10%",
                    opacity: "100",
                    sizing_policy: "ShrinkToFit"
                }
            }
        },
        {
            "id": "566b0fbf044dfe64f2000003",
            "name": "System preset: Generic 720p",
            "container": "mp4",
            "video": {
                "codec": "H.264",
                "bit_rate": "2400",
                "fps": "29.97",
                "max_width": "1280",
                "max_height": "720"
            },
            "audio": {
                "codec": "AAC",
                "bit_rate": "160",
                "sample_rate": "44100",
                "channels": "2"
            },
            watermarks: {...}
        },
        {
            "id": "566b0fbf044dfe64f2000004",
            "name": "System preset: Generic 480p 16:9",
            "container": "mp4",
            "video": {
                "codec": "H.264",
                "bit_rate": "1200",
                "fps": "29.97",
                "max_width": "854",
                "max_height": "480"
            },
            "audio": {
                "codec": "AAC",
                "bit_rate": "128",
                "sample_rate": "44100",
                "channels": "2"
            },
            watermarks: {...}
        }
    ]
}

/transcoder

Description Method to create task for trascoding
Endpoint https://api.platformcraft.ru/1/transcoder/{:object_id}
Method POST
Body content type JSON
Response Status
Comments Maximum number of tasks in the queue : 200. Maximum number of simultaneous tasks: 2

Request body format

{
   "presets": ["presetID",...],        # list of preset IDs for transcoding
   "names": {"presetID": "String"},    # a dictionary of the form {"preset_id": "file_name"}, where preset_id is the desired preset, file_name is the desired name of the output file. This parameter allows you to set custom names for transcoded video copies
   "path": "String",                   # File download path. Optional. Default path is path of transcoding file.
   "watermarks": {"String": "String"}, # dictionary {watermark_id: object_id}, where watermark_id - watermark id, object_id - picture id (supported extensions - .png и .jpg). Optional. It adds watermark to a video. See GET /transcoder/presets for getting info about watermark_id.
   "del_original": Bool,               # delete original video after transcoding (default: false)
   "start": Int,                       # position of the beginning of transcoding (number of seconds from the beginning of the file, default: 0)
   "duration": Int,                    # duration of transcoding (in seconds, default: 0). If duration == 0, then the entire media file will be transcoded, starting at position "start".
   "show_progress": Bool               # show transcoding progress
}

Note: If the presets field is empty and start> 0 or duration> 0, then the method will cut the media file without transcoding.

Example of request body

{
   "presets": ["5676a27cf9cb101634000002","5676a27cf9cb101634000003"],
   "names": {"5676a27cf9cb101634000002": "test720p.mp4", "5676a27cf9cb101634000003": "test480p.mp4"},
   "watermarks": {"Full": "5adfa939534b446a607d9937"},
   "del_original": false,
   "show_progress": true
}

Example of response

{
    "code":         200,
    "status":       "success",
    "message":      "Task create success.",
    "active_tasks": 2,
    "task_id":      "56ea79e2534b4423135ebfd3"
}
Description Method to create task for files concatenation
Endpoint https://api.platformcraft.ru/1/transcoder?concat
Method POST
Body content type JSON
Response Information about task

Response format

{
   "files": ["String",...], # ordered list of file ids for concatenation (from 2 to 20 files)
   "path": "String"         # file upload directory. Optional. By default, new files are placed in the root directory.
   "name": "String"         # file name
}

Example of request body

{
    "files": ["5adfa9bc534b446a7f5d3c0c","5ade3ad1534b445140d49539"],
    "path": "/dir",
    "name": "concat.mp4"
}

Example of response

{
    "code":         200,
    "status":       "success",
    "message":      "Task create success.",
    "active_tasks": 2,
    "task_id":      "56ea79e2534b4423135ebfd3"
}
Description Method to create task for transcoding HLS
Endpoint https://api.platformcraft.ru/1/transcoder/hls/{:object_id}
Method POST
Body content type JSON
Response Status

Request body format

{
   "presets": ["presetID",...], # list of preset IDs for transcoding
   "segment_duration": Int      # video segment duration in sec. from 1 to 60
}

Example of request body

{
   "presets": ["5693b900534b440cd053f5a5","5693b900534b440cd053f5a3"],
   "segment_duration": 20
}

Example of response

{
    "code":         200,
    "status":       "success",
    "message":      "Task create success.",
    "active_tasks": 2,
    "task_id":      "56ea79e2534b4423135ebfd3"
}
Description Method for cutting a screenshot specified time
Endpoint URL https://api.platformcraft.ru/1/transcoder/screenshot/{:object_id}
Method POST
Body content type application/json
Response Information about the created screenshot

Request body format

{
    "position": Float,      # the position of the screenshot from the beginning of the file (seconds)
    "name":     "String",   # screenshot name
    "path":     "String"    # directory
}

Example of request body

{
    "position": 10.5,
    "name": "screen.jpg",
    "path": "/black/screens"
}

Example of response

{
    "code": 200,
    "status": "success",
    "object": {
        "id": "6087cdb60e47cf6292960fef",
        "name": "screen.jpg",
        "path": "/black/screens/screen.jpg",
        "is_dir": false,
        "size": 47642,
        "content_type": "image/jpeg",
        "create_date": "27.04.2021T11:39:19",
        "resource_url": "api.platformcraft.ru/1/objects/6087cdb60e47cf6292960fef",
        "cdn_url": "cdn.platformcraft.ru/example/black/screens/screen.jpg",
        "private": false,
        "status": "ok",
        },
    "storage": {
        "used": 400587972741,
        "limit": 536870912000
    }
}
Description Method for creating an image resizing task
URL structure https://api.platformcraft.ru/1/transcoder/image/{:object_id}
Method POST
Request body type application/json
Returns Status of the task statement

Request body format

{
    "path":     "String"    # upload directory
    "name":     "String",   # resulting image name
    "width":    Int,        # resulting image width (at least one `width` or `height` must be specified)
    "height":   Int         # resulting image height (at least one `width` or `height` must be specified)
}

Example of request body

{
    "path":     "/black/images"
    "name":     "test.jpg",
    "width":    200
}

Example of response

{
    "active_tasks": 1,
    "code": 200,
    "message": "Task create success.",
    "status": "success",
    "task_id": "63ca4654534b44c667c9a4c5"
}
Description Method for creating a task for dividing a video file into components
Endpoint URL https://api.platformcraft.ru/1/transcoder?decompose
Method POST
Body content type JSON
Возвращает Status

Request body format

{
    "file": "String",                       # id of input video file
    "path": "String",                       # the folder where the generated files will be placed (if the specified folder does not exist, it will be created automatically)
    "subtitle_type": "String",              # Subtitle type (possible values: ttml, vtt)
    "subtitle_langs": ["String",...]        # Subtitle languages
}

Example of request body

{
    "file": "5e1bb131ef3db56034d1bfcc",
    "path": "/test",
    "subtitle_type": "ttml",
    "subtitle_langs": ["rus", "eng"]
}

Example of request body

{
    "code":         200,
    "status":       "success",
    "message":      "Task create success.",
    "active_tasks": 2,
    "task_id":      "56ea79e2534b4423135ebfd3"
}

/transcoder_tasks

Description Method to get list task for transcoding
Endpoint https://api.platformcraft.ru/1/transcoder_tasks
Method GET
Response List of tasks
Filter parameters
status Status of the task (Possible values: Progress, Completed, Error). Optional.
start Timestamp of the lower bound of the beginning of the task execution. Optional.
end Timestamp of the upper bound of the start of task execution. Optional.
Sorting parameters
sort Sorting parameter (optional). Possible values:
"time" - sorting by time (in ascending order).
"-time" - sort by time (in descending order).
"status" - sorting by status (in ascending order).
"-status" - sorting by status (in descending order).
"lock" - sorting by the `lock` field (in ascending order).
"-lock" - sorting by the `lock` field (in descending order).
Pagination parameters
limit Number of tasks per page. Optional. To request the next page, you need to use the url enclosed in the "next" field of the server response
from The marker for the start of the next page (optional). The "from" parameter is automatically generated by the server in the "next" response field.

Example of response

{
    "code": 200,
    "status": "success",
    "count": 5,              # the total number of tasks that match the query parameters
    "count_on_page": 3,      # number of tasks per page
    "next": "api.platformcraft.ru/1/transcoder_tasks?limit=3&from=60d1ea97534b4473a74028c2&start=1623834785&end=1636449185",  # next page request (no field if there is no next page)
    "tasks": [
        {
            "id": "56365b04044dfe6917000002",
            "category": "encoding",
            "title": "Encoding Копия test.360p.mp4",
            "body": "Please wait.",
            "status": "Progress",
            "time_start": "01.11.2015T21:33:40",
            "time_finish": "",
            "lock": true,
            "object_id": "5f686d6f534b4443dc236f78",     # source file id
            "out": [
                {
                    "name": "",
                    "duration": 9.288,                   # duration of the transcoded file
                    "preset": "5825d926702b9371dd9bca44" # preset used to transcode the file. Detailed information about a preset can be obtained using the method  `GET https://api.platformcraft.ru/1/transcoder/presets/{:preset_id}`
                }
        },
        {
            "id": "566b3a9d044dfe7381000002",
            "category": "encoding",
            "title": "Encoding test (480p).mp4",
            "body": "Internal server error. Please try again later.",
            "status": "Error",
            "time_start": "12.12.2015T00:05:33",
            "time_finish": "12.12.2015T00:05:47",
            "lock": false,
            "object_id": "5f686d6f534b4443dc236f78",
            "out": [
                {
                    "name": "",
                    "duration": 9.288,
                    "preset": "5825d926702b9371dd9bca44"
                }
        },
        {
            "id": "566b4173044dfe771c000001",
            "category": "encoding",
            "title": "Encoding test (480p).mp4",
            "body": "Encoding video success.",
            "status": "Completed",
            "time_start": "12.12.2015T00:34:43",
            "time_finish": "12.12.2015T00:35:56",
            "lock": false,
            "object_id": "5f686d6f534b4443dc236f78",
            "out": [
                {
                    "name": "",
                    "duration": 9.288,
                    "preset": "5825d926702b9371dd9bca44"
                }
        }
    ]
}
Description Method to get information about task with selested ID
Endpoint https://api.platformcraft.ru/1/transcoder_tasks/{:task_id}
Method GET
Response Information about task

Example of response

{
    "code": 200,
    "files":["56ea7c4e534b44353536586c"],
    "status": "success",
    "task": {
        "id": "56365b04044dfe6917000002",
        "category": "encoding",
        "title": "Encoding Копия test.360p.mp4",
        "body": "Please wait.",
        "status": "Progress",
        "time_start": "01.11.2015T21:33:40",
        "time_finish": "",
        "lock": true
    }
    "progress": 50,                              # transcoding progress (%)
    "progress_detailed": {
        "5676a27cf9cb101634000002": 50,          # transcoding progress  (%) for each preset
        "5676a27cf9cb101634000003": 60
    }
    "object_id": "5f686d6f534b4443dc236f78",     # source file id
    "out": [
        {
            "name": "",
            "duration": 9.288,                   # duration of the transcoded file
            "preset": "5825d926702b9371dd9bca44" # preset used to transcode the file. Detailed information about a preset can be obtained using the method `GET https://api.platformcraft.ru/1/transcoder/presets/{:preset_id}`
        }
}
Description Method to get information about HLS task with selected ID
Endpoint https://api.platformcraft.ru/1/transcoder_tasks/hls/{:task_id}
Method GET
Response Information about HLS task

Example of response

{
    "code":200,
    "files":{
        "master_playlist":"56ea7c4e534b44353536586c",
        "media":[
            {
                "playlist":"56ea7c4e534b44353536586d",
                "files":[
                    "56ea7c4f534b44353536586e",
                    "56ea7c50534b44353536586f",
                    "56ea7c50534b443535365870"
                ]
            },
            {
                "playlist":"56ea7c55534b443535365878",
                "files":[
                    "56ea7c55534b443535365879",
                    "56ea7c55534b44353536587a",
                    "56ea7c56534b44353536587b"
                ]
            }
        ]
    },
    "status":"success",
    "task":{
        "id":"56ea7c2f534b440c83fe85bc",
        "category":"encoding",
        "title":"Encoding abc.mp4",
        "body":"Encoding video success.",
        "status":"Completed",
        "time_start":"17.03.2016T12:43:11",
        "time_finish":"17.03.2016T12:43:53",
        "lock":false
    }
}
Description Method to delete task from queue (You can only delete an unlocked/unblocked task)
Endpoint https://api.platformcraft.ru/1/transcoder_tasks/{:task_id}
Method DELETE
Response Status

Example of response

{
    "code": 200,
    "message": "Task delete success.",
    "status": "success"
}

/storage

Description Method to get information about storage volume
Endpoint https://api.platformcraft.ru/1/storage
Method GET
Response Information about storage volume

Response format

{
    "code":     Int,       # http code (200)
    "status":   "String",  # status
    "storage": {
        "used": Int,       # used storage volume (bytes)
        "limit": Int       # storage capacity (bytes)
    }
}

Example of response

{
    "code": 200,
    "status": "success",
    "storage": {
        "used": 97537237,
        "limit": 107374182
    }
}

Errors

Response format

{
    "code":     Int,       # http code
    "status":   "String",  # status (fail)
    "msg_user": "String",  # error description
    "msg_dev":  "String",  # detailed description of error
    "doc":      "String",  # URL to documentation
    "advanced": "String"   # additional Information
}

HTTP codes

400 - Bad Request,
403 - Forbidden,
404 - Not Found.

Example of response

{
    "code": 400
    "status": "fail"
    "msg_user": "Api ID, timestamp and hash are required."
    "msg_dev": "Check Api id, timestamp and hash."
    "doc": "http://doc.platformcraft.ru/filespot/api/#access"
    "advanced": null
}

Libraries

platformcraft-filespot для Ruby