Limits
Please note that the "auth", "filespot", "streamer" and "recorder" services have a limit of no more than 10 requests per second.
Authorization
https://auth.platformcraft.ru
To transfer authorization data, the JWT standard is used. Authorization scheme:
-
The client is authorized in the application (using login and password, see “Getting refresh and access tokens”).
-
In case of successful authorization, the service sends access (life time – 24 hours) and refresh (life time – 30 days) tokens to the client.
-
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.
-
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").
-
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
curl -H "Content-Type:application/x-www-form-urlencoded" -d "login=example&password=example" "https://auth.platformcraft.ru/token"
var xhr = new XMLHttpRequest();
xhr.addEventListener('load', function(e) {
var response = e.target.responseText;
console.log(response);
});
xhr.addEventListener('error', function(e) {
console.error('Request errored with status', e.target.status);
});
xhr.open('POST', 'https://auth.platformcraft.ru/token');
xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
var body = 'login=example&password=example'; //enter your login and password
xhr.send(body);
import requests
url = 'https://auth.platformcraft.ru/token'
headers = {'Content-Type': 'application/x-www-form-urlencoded'}
body = """login=example&password=example""" #enter your login and password
req = requests.post(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"user_id": "5b30bc7c1658f770c3a2bf5c",
"owner_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"
}
curl "https://auth.platformcraft.ru/refresh" \
-X POST \
-d "{\n \"user_id\": \"{your_user_ID}\",\n \"refresh_token\": \"{your_refresh_token}\"\n}" \
-H "Authorization: Bearer {your_access_token}: application/json"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}: application/json'); //Please use your {your_access_token}
//Please use your {your_user_ID} and {your_refresh_token}
const body = `{
"user_id": "{your_user_ID}",
"refresh_token": "{your_refresh_token}"
}`;
const init = {
method: 'POST',
headers,
body
};
fetch('https://auth.platformcraft.ru/refresh', init)
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://auth.platformcraft.ru/refresh'
headers = {'Authorization': 'Bearer {your_access_token}: application/json'} #Please use your {your_access_token}
#Please use your {your_user_ID} and {your_refresh_token}
body = """{
"user_id": "{your_user_ID}",
"refresh_token": "{your_refresh_token}"
}"""
req = requests.post(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"user_id": "5b30bc7c1658f770c3a2bf5c",
"owner_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"
}
Filespot
https://filespot.platformcraft.ru/2/
File upload
Description | Method uploads a file to the platform |
URL structure | https://filespot.platformcraft.ru/2/fs/container/{container_id}/object{file_path} |
Method | POST |
Request body type application | multipart/form-data |
Returns | file information (JSON) |
URL parameters | |
container_id | container ID corresponds owner_ID from section Authorization |
file_path | file path inside container |
Parameteres | |
file | file upload |
dir | folder creation (if the "dir" parameter is present, a folder is created instead of the file) |
Request example
https://filespot.platformcraft.ru/2/fs/container/5b30bc7c1658f770c3a2bf5c/object/test/test.mp4
curl "https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/path/to/file.mp4" \
-X POST \
-F "file=@{path_to_local_file}" \
-H "Authorization: Bearer {your_access_token}" \
-H "Content-Type: multipart/form-data"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
headers.append('Content-Type', 'multipart/form-data');
const body = `[object FormData]`;
const init = {
method: 'POST',
headers,
body
};
fetch('https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/path/to/file.mp4', init) //Replace {your_owner_ID} with your own. After "object" specify the desired path and file name.
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/path/to/file.mp4' #Replace {your_owner_ID} with your own. After "object" specify the desired path and file name.
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
files = {'file' : open('{path_to_local_file}', 'rb')}
req = requests.post(url, headers=headers, files=files)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5a2eac3b2973db0008e12388",
"is_dir": false,
"type": "file",
"status": "ok",
"name": "file.mp4",
"path": "/path/to/file.mp4",
"size": 387531,
"content_type": "video/mp4",
"description": "",
"create_date": "20.09.2020T21:28:27",
"latest_update": "20.09.2020T21:28:27",
"private": false,
"advanced": {...},
"download_url": "test.cdn.ru/account/path/to/file.mp4,
"hls": "video.platformcraft.ru/vod/video/5a2eac3b2973db0008e12388/playlist.m3u8"
}
Chunk uploading
Initialize chunk uploading
Description | Method for uploading chunk uploading |
URL structure | https://filespot.platformcraft.ru/2/fs/container/{container_id}/object{file_path}?uploads |
Method | POST |
Returns | information about the created upload event (JSON). |
URL parameters | |
container_id | container ID corresponds owner_ID from section Authorization |
file_path | file path inside container |
Request example
https://filespot.platformcraft.ru/2/fs/container/5b30bc7c1658f770c3a2bf5c/object/test/test.mp4?uploads
curl "https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/test/test.mp4?uploads" \
-X POST \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Вместо {your_access_token} подставьте свой
const init = {
method: 'POST',
headers
};
fetch('https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/test/test.mp4?uploads', init)
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/test/test.mp4?uploads'
headers = {'Authorization': 'Bearer {your_access_token}'}
req = requests.post(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5a2ea8b52973db0008e12386", // uploadId
"container_id": "5b30bc7c1658f770c3a2bf5c",
"object_path": "/test/test.mp4",
"created_at": 1513007285,
"parts": null
}
Upload one part of a file
Description | Method for uploading one part of a file |
URL structure | https://filespot.platformcraft.ru/2/fs/container/{container_id}/object?uploadId={uploadId}&uploadPartNum={uploadPartNum} |
Method | PUT |
Request body type application | application/octet-stream |
Headers | Content-Length - the size of the downloaded part of the file |
URL parameters | |
container_id | container ID corresponds owner_ID from section Authorization |
Parameteres | |
uploadId | upload event id |
uploadPartNum | serial number of the file part |
Request example
https://filespot.platformcraft.ru/2/fs/container/5b30bc7c1658f770c3a2bf5c/object?uploadId=5a2ea8b52973db0008e12386&uploadPartNum=0
curl "https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object?uploadId=5a2ea8b52973db0008e12386&uploadPartNum=1" \
-X PUT \
-d {} \
-H "Authorization: Bearer {your_access_token}" \
-H "Content-Type: application/octet-stream" \
-H "Content-Length: 20971409"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}');
headers.append('Content-Type', 'application/octet-stream');
headers.append('Content-Length', '20971409');
const body = `[object File]`;
const init = {
method: 'PUT',
headers,
body
};
fetch('https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object?uploadId=5a2ea8b52973db0008e12386&uploadPartNum=1', init)
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object?uploadId=5a2ea8b52973db0008e12386&uploadPartNum=1'
headers = {
'Authorization': 'Bearer {your_access_token}',
'Content-Type': 'application/octet-stream',
'Content-Length': '20971409'
}
with open('/local/file/chunk1','rb') as body:
req = requests.put(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Complete file upload in parts
Description | Method to complete file upload in parts |
URL structure | https://filespot.platformcraft.ru/2/fs/container/{container_id}/object?uploadId={uploadId} |
Method | POST |
Request body type application | application/json |
Returns | file information |
URL parameters | |
container_id | container ID corresponds owner_ID from section Authorization |
Parameteres | |
uploadId | upload event id |
Request example
https://filespot.platformcraft.ru/2/fs/container/5b30bc7c1658f770c3a2bf5c/object?uploadId=5a2ea8b52973db0008e12386
Request body example
{
"sha256": "679b2bbb21fed73103b22d99e5ce4103f3bdce0dd492e9dea54ec30269113bc0" // хеш-сумма файла (sha256)
}
curl "https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object?uploadId=5a2ea8b52973db0008e12386 \
-X POST \
-d "{\"sha256\": \"4c0e8fd63af9a3fdd397aa1ed561f560cbfb34e7da66426ad1aaa139fe22a9d3\"}" \
-H "Authorization: Bearer {your_access_token}" \
-H "Content-Type: application/json"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}');
headers.append('Content-Type', 'application/json');
const body = `{
"sha256": "4c0e8fd63af9a3fdd397aa1ed561f560cbfb34e7da66426ad1aaa139fe22a9d3"
}`;
const init = {
method: 'POST',
headers,
body
};
fetch('https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object?uploadId=5a2ea8b52973db0008e12386', init)
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object?uploadId=5a2ea8b52973db0008e12386'
headers = {
'Authorization': 'Bearer {your_access_token}',
'Content-Type': 'application/json',
}
body = """{
"sha256": "4c0e8fd63af9a3fdd397aa1ed561f560cbfb34e7da66426ad1aaa139fe22a9d3"
}"""
req = requests.post(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5a2eac3b2973db0008e12388",
"is_dir": false,
"type": "file",
"status": "ok",
"name": "test.mp4",
"path": "/test/test.mp4",
"size": 387531,
"content_type": "video/mp4",
"description": "",
"create_date": "20.09.2020T21:28:27",
"latest_update": "20.09.2020T21:28:27",
"private": false,
"advanced": {...},
"download_url": "test.cdn.ru/account/test/test.mp4,
"hls": "video.platformcraft.ru/vod/video/5a2eac3b2973db0008e12388/playlist.m3u8"
}
Cancel file upload in parts
Description | Cancel file upload in parts |
URL structure | https://filespot.platformcraft.ru/2/fs/container/{container_id}/object?uploadId={uploadId} |
Method | DELETE |
URL parameters | |
container_id | container ID corresponds owner_ID from section Authorization |
Parameteres | |
uploadId | id upload event id |
Request example
https://filespot.platformcraft.ru/2/fs/container/5b30bc7c1658f770c3a2bf5c/object?uploadId=5a2ea8b52973db0008e12386
curl "https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object?uploadId=5a2ea8b52973db0008e12386 \
-X DELETE \
-H "Authorization: Bearer {your_access_token}" \
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}');
const init = {
method: 'DELETE',
headers
};
fetch('https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object?uploadId=5a2ea8b52973db0008e12386', init)
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object?uploadId=5a2ea8b52973db0008e12386'
headers = {
'Authorization': 'Bearer {your_access_token}',
}
req = requests.delete(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Getting information about a chunk uploading
Description | Method for getting information about a file upload event in parts |
URL structure | https://filespot.platformcraft.ru/2/fs/container/{container_id}/object{file_path}?uploaId={uploadId} |
Method | GET |
Returns | upload event information (JSON) |
URL parameters | |
container_id | container ID corresponds owner_ID from section Authorization |
file_path | file path inside container |
Parameteres | |
uploadId | upload event id |
Request example
https://filespot.platformcraft.ru/2/fs/container/5b30bc7c1658f770c3a2bf5c/object?uploadId=5a2ea8b52973db0008e12386
curl "https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object?uploadId=5a2ea8b52973db0008e12386 \
-X GET \
-H "Authorization: Bearer {your_access_token}" \
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}');
const init = {
method: 'GET',
headers
};
fetch('https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object?uploadId=5a2ea8b52973db0008e12386', init)
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object?uploadId=5a2ea8b52973db0008e12386'
headers = {
'Authorization': 'Bearer {your_access_token}',
}
req = requests.get(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5a2ea8b52973db0008e12386",
"container_id": "5b30bc7c1658f770c3a2bf5c",
"object_path": "/test/test.mp4",
"created_at": 1513007285,
"parts": [
{
"id": 0,
"src": "5a2eaeb12973db0008e1238d_0",
"size": 100000
},
{
"id": 1,
"src": "5a2eaeb12973db0008e1238d_1",
"size": 100000
}
}
Getting a file or folder information
Description | Method for getting information about file or folder information |
URL structure | https://filespot.platformcraft.ru/2/fs/container/{container_id}/object{file_path} |
Method | GET |
Request body type application | application/json |
Returns | file or folder information in JSON format |
URL parameters | |
container_id | container ID corresponds owner_ID from section Authorization |
file_path | file path inside container |
Pagination options | |
sort |
Sorting parameter (optional). Possible values:
"name" - sorting by name (ascending). "-name" - sorting by name (descending). "time" - sorting by time (ascending). "-time" - sorting by time (descending). "size" - sorting by size (ascending). "-size" - sorting by size (descending). For any value of the "sort" parameter, the folders in the listing appear in front of the files. Default value is "name". |
limit | Number of objects on one page (optional). Default value is 5000. Max value is 100000. |
from | Start of next page marker (optional). The "from" parameter is generated by the server automatically in the "paging.next" response field. |
files_only | With the "files_only" parameter, only files will be returned as folder contents. |
dirs_only | With the "dirs_only" parameter, only folders will be returned as folder contents. |
Request example
https://filespot.platformcraft.ru/2/fs/container/5b30bc7c1658f770c3a2bf5c/object/test?sort=-time&limit=1&files_only
curl "https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/path/to/file.mp4" \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'GET',
headers
};
fetch('https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/path/to/file.mp4', init) //Please include your {your_owner_ID} and file path after "/ object /"
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/path/to/file.mp4' #Please include your {your_owner_ID} and file path after "/ object /"
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.get(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5accd99b1658f770c3a274ce",
"status": "",
"name": "test",
"path": "/test",
"size": 0,
"content_type": "",
"create_date": "",
"latest_update": "",
"private": false,
"preview_url": "",
"download_url": "",
"contents": [
{
"id": "5accda6edc96bf0a90d8a0a5",
"status": "ok",
"name": "test.mp4",
"path": "/test/test.mp4",
"size": 2372804,
"content_type": "video/mp4",
"create_date": "10.04.2018T18:38:22",
"latest_update": "10.04.2018T18:38:23",
"private": false,
"advanced": {
"audio_streams": [
{
"bit_rate": 79473,
"channel_layout": "stereo",
"channels": 2,
"codec_long_name": "AAC (Advanced Audio Coding)",
"codec_name": "aac",
"codec_type": "audio",
"duration": 15.041,
"index": 1,
"language": "eng",
"sample_rate": 48000
}
],
"format": {
"bit_rate": 1263810,
"duration": 15.02,
"format_long_name": "QuickTime / MOV",
"format_name": "mov,mp4,m4a,3gp,3g2,mj2",
"nb_streams": 3
},
"video_streams": [
{
"bit_rate": 1417636,
"codec_name": "h264",
"codec_type": "video",
"codeclongname": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"display_aspect_ratio": "0:1",
"duration": 15.05,
"fps": 23.97884755652808,
"height": 544,
"index": 0,
"width": 960
}
],
},
"preview_url": "originstack.cdnvideo.ru/5accda6edc96bf0a90d8a0a9",
"download_url": "originstack.cdnvideo.ru/alexmurm/test/test.mp4"
}
],
"paging": {
"count": 20,
"count_on_page": 1,
"next": "https://filespot.platformcraft.ru/2/fs/container/5b30bc7c1658f770c3a2bf5c/object?sort=-time&limit=1&from=f5accda6edc96bf0a90d8a0a5&files_only"
}
}
Delete file or folder
Description | Method deletes file or folder |
URL structure | https://filespot.platformcraft.ru/2/fs/container/{container_id}/object{file_path} |
Method | DELETE |
URL parameters | |
container_id | container ID corresponds owner_ID from section Authorization |
file_path | file path inside container |
Request example
https://filespot.platformcraft.ru/2/fs/container/5b30bc7c1658f770c3a2bf5c/object/test/test.mp4
curl "https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/path/to/file.mp4" \
-X DELETE \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'DELETE',
headers
};
fetch('https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/path/to/file.mp4', init) //Please include your {your_owner_ID} and file path after "/ object /"
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/path/to/file.mp4' #Please include your {your_owner_ID} and file path after "/ object /"
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.delete(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Change file or folder
Description | Method changes file or folder |
URL structure | https://filespot.platformcraft.ru/2/fs/container/{container_id}/object{file_path} |
Method | PUT |
Request body type application | application/json |
URL parameters | |
container_id | container ID corresponds owner_ID from section Authorization |
file_path | file path inside container |
Parameteres | |
name | name |
dir | dir |
description | description |
private | private or not |
max_height | max height |
max_width | max width |
Request example
https://filespot.platformcraft.ru/2/fs/container/5b30bc7c1658f770c3a2bf5c/object/test/test.mp4
Request body example
{
"name": "test_1.mp4"
}
curl "https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/path/to/file.mp4" \
-X PUT \
-d "{\n \"name\": \"test_name\",\n \"description\": \"test description\",\n \"private\": true\n}" \
-H "Authorization: Bearer {your_access_token}" \
-H "Content-Type: application/json"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
headers.append('Content-Type', 'application/json');
const body = `{
"name": "test_name",
"description": "test description",
"private": true
}`;
/*
name - change the name of the file/folder
dir - move file/folder
description - add a description to the file
private - false/true closes and makes the file available
max_height и max_width - set the maximum available image values when resizing on the fly
*/
const init = {
method: 'PUT',
headers,
body
};
fetch('https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/path/to/file.mp4', init) //Please include your {your_owner_ID} and file path after "/ object /"
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://filespot.platformcraft.ru/2/fs/container/{your_owner_ID}/object/path/to/file.mp4' #Please include your {your_owner_ID} and file path after "/ object /"
headers = {'Authorization': 'Bearer {your_access_token}','Content-Type': 'application/json'} #Please use your {your_access_token}
body = """{
"name": "test_name",
"description": "test description",
"private": true
}"""
#name - change the name of the file/folder
#dir - move file/folder
#description - add a description to the file
#private - false/true closes and makes the file available
#max_height и max_width - set the maximum available image values when resizing on the fly
req = requests.put(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Recorder
https://rec.platformcraft.ru
Stream creation
Description | Method for creating hls stream |
URL structure URL | https://rec.platformcraft.ru/{owner_ID} |
Method | POST |
Request body type application | application/json |
Returns | Information about the created stream |
Parameters | |
name | stream name |
qualities | a dictionary {"src": "quality"}, where src is the source of the stream, quality is the quality of the stream. |
src | stream source. Deprecated parameter, use qualities |
parse_master | if the only source of the stream is specified (in the qualities or src parameter), and this is a master playlist, parse it into its constituent media playlists |
Example of a request indicating each quality
https://rec.platformcraft.ru/56bdf4a53f4f716301b09ba3
Request body example
{
"name": "stream_name",
"qualities": {
"https://example.com/360p.m3u8": "360p",
"https://example.com/480p.m3u8": "480p"
}
}
Example of a request specifying a master playlist
https://rec.platformcraft.ru/56bdf4a53f4f716301b09ba3
Request body example
{
"name": "stream_name",
"src": "https://example.com/playlist.m3u8",
"parse_master": true
}
curl "https://rec.platformcraft.ru/{your_owner_ID}" \
-X POST \
-d "{\r\n \"name\": \"stream_name\",\r\n \"qualities\": {\r\n \"https://example.com/360p.m3u8\": \"360p\",\r\n \"https://example.com/480p.m3u8\": \"480p\"\r\n }\r\n}" \
-H "content-type: application/json"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Replace {your_access_token} with your
headers.append('Content-Type', 'application/json');
//Provide a name and link to the stream. You can add only .m3u8 (HLS) streams
const body = `{
"name": "stream_name",
"qualities": {
"https://example.com/360p.m3u8": "360p",
"https://example.com/480p.m3u8": "480p"
}
}`;
const init = {
method: 'POST',
headers,
body
};
fetch('https://rec.platformcraft.ru/{your_owner_ID}', init) //Replace your {your_owner_ID}
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://rec.platformcraft.ru/{your_owner_ID}' #Replace your {your_owner_ID}
headers = {'Authorization': 'Bearer {your_access_token}','Content-Type': 'application/json'} #Replace {your_access_token} with your
#Provide a name and link to the stream. You can add only .m3u8 (HLS) streams
body = """{
"name": "stream_name",
"qualities": {
"https://example.com/360p.m3u8": "360p",
"https://example.com/480p.m3u8": "480p"
}
}"""
req = requests.post(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5c8d5174534b4427730ebf7f",
"name": "stream_name",
"qualities": {
"https://example.com/360p.m3u8": "360p",
"https://example.com/480p.m3u8": "480p",
},
"src": "https://example.com/360p.m3u8": "360p",
"instant_record_id": "" // id of instant record
}
Note
There are two types of stream recording:
а. Instant recording. It is launched using the "Start instant stream recording" method. Only one instant recording can exist for one stream at a time.
б. Scheduled Recording. Created using the “Create scheduled record” method.
Stream change
Description | Method for changing hls stream |
URL structure | https://rec.platformcraft.ru/{owner_ID}/{stream_id} |
Method | PUT |
Request body type application | application/json |
Returns | Information about the stream |
Request example
https://rec.platformcraft.ru/56bdf4a53f4f716301b09ba3/5c8d5174534b4427730ebf7f
Request body example
{
"name": "new_stream_name"
}
curl "https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}" \
-X PUT \
-d "{\n \"name\": \"aplemakh\"\n}" \
-H "Authorization: Bearer {your_access_token}" \
-H "Content-Type: application/json"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
headers.append('Content-Type', 'application/json');
//Set a new name for the stream
const body = `{
"name": "new_name"
}`;
const init = {
method: 'PUT',
headers,
body
};
fetch('https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}', init) //Replace {your_owner_ID} and {stream_id} with your parameters
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}' #Replace {your_owner_ID} and {stream_id} with your parameters
headers = {'Authorization': 'Bearer {your_access_token}','Content-Type': 'application/json'} #Please use your {your_access_token}
#Set a new name for the stream
body = """{
"name": "new name"
}"""
req = requests.put(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5c8d5174534b4427730ebf7f",
"name": "new_stream_name",
"src": "https://example.com/playlist.m3u8",
"instant_record_id": ""
}
Getting a list of streams
Description | Method for getting a list of hls streams |
URL structure | https://rec.platformcraft.ru/{owner_ID} |
Method | GET |
Request body type application | - |
Returns | Information about streams |
Request example
https://rec.platformcraft.ru/56bdf4a53f4f716301b09ba3
curl "https://rec.platformcraft.ru/{your_owner_ID}" \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Pleae use your {your_access_token}
const init = {
method: 'GET',
headers
};
fetch('https://rec.platformcraft.ru/{your_owner_ID}', init) //Use your {your_owner_ID}
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://rec.platformcraft.ru/{your_owner_ID}' #Use your {your_owner_ID}
headers = {'Authorization': 'Bearer {your_access_token}'} #Pleae use your {your_access_token}
req = requests.get(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5c8d5174534b4427730ebf7f",
"name": "new_stream_name",
"src": "https://example.com/playlist.m3u8",
"instant_record_id": ""
}
Getting information about stream
Description | Method for getting information about one hls stream |
URL structure | https://rec.platformcraft.ru/{owner_ID}/{stream_id} |
Method | GET |
Request body type application | - |
Returns | Information about stream |
Request example
https://rec.platformcraft.ru/56bdf4a53f4f716301b09ba3/5c8d5174534b4427730ebf7f
curl "https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}" \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'GET',
headers
};
fetch('https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}', init) //Replace {your_owner_ID} and {stream_id} with your own values
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}' #Replace {your_owner_ID} and {stream_id} with your own values
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.get(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5c8d5174534b4427730ebf7f",
"name": "new_stream_name",
"src": "https://example.com/playlist.m3u8",
"instant_record_id": ""
}
Delete stream
Description | Method for deleting hls stream |
URL structure | https://rec.platformcraft.ru/{owner_ID}/{stream_id} |
Метод | DELETE |
Request body type application | - |
Returns | - |
curl "https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}" \
-X DELETE \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'DELETE',
headers
};
fetch('https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}', init) //Replace {your_owner_ID} and {stream_id} with your own values
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}' #Replace {your_owner_ID} and {stream_id} with your own values
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.delete(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Start instant stream recording
Description | Method for starting instant stream recording |
URL structure | https://rec.platformcraft.ru/{owner_ID}/{stream_id}/start |
Method | POST |
Request body type application | application/json |
Returns | Information about stream |
Parameteres | |
Required: | |
path | path of the created video file in the format "/container/{owner_ID}/object{object_path} |
Optional: | |
client's email. If an email is specified, notifications about the recording status will be sent to it (only in case of problems with the stream) | |
max_dur | maximum duration of the recorded video file in seconds (default max_dur=2592000, i.e. 30 days). If the recording duration exceeds max_dur, then only the last max_dur seconds of recording will be recorded in the video file. For example: max_dur = 3600, the recording time was 7200 seconds (2 hours). The video file will contain only the last hour of recording. |
stop_timeout | record stop timeout in seconds (default is 1800, i.e. 30 minutes). If motion_record = true, then recording to the video file will take place within stop_timeout seconds after receiving the last picture via ftp server (see motion_record parameter). If motion_record = false, in case the stream will not be writable within stop_timeout seconds, the recording will be stopped (if events_record = false) or recording will be stopped in the video file (if events_record = true). |
motion_record | boolean type parameter (false by default). Motion Recording. It takes precedence over the events_record parameter. For motion recording, you need to connect the camera software to the ftp server at rec.platformcraft.ru. If true, then the stream recording will start at the moment when the picture is sent to the ftp server. Recording to the newly created file will stop after stop_timeout seconds have passed after the last picture was received. As soon as a new ftp picture arrives, a new video file is created and recording continues. |
events_record | boolean type parameter (false by default). Event recording stream. If false, then in case of recording problems within stop_timeout seconds, the recording will be disabled completely. If true, then in case of recording problems within stop_timeout seconds, recording of the stream to the video file will end, then recording will continue, waiting for the stream to resume. As soon as the stream becomes available again, a new event video file will be created. Etc. |
Request example
https://rec.platformcraft.ru/56bdf4a53f4f716301b09ba3/5c8d5174534b4427730ebf7f/start
Request body example
{
"path": "/container/567687df4f60c8cc3145cc03/object/test/test.m3u8",
"email": "test@test.te",
"max_dur": 3600,
"stop_timeout": 600,
"events_record": true
}
curl "https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/start" \
-X POST \
-d "{\n \"path\": \"/container/{your_owner_ID}/object/path/to/file.m3u8\",\n \"email\": \"your@email.com\",\n \"max_dur\": 3600,\n \"stop_timeout\": 600,\n \"events_record\": false\n}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const body = `{
"path": "/container/{your_owner_ID}/object/path/to/file.m3u8",
"email": "your@email.com",
"max_dur": 3600,
"stop_timeout": 600,
"events_record": false
}`;
//Replace {your_owner_ID} with yours. After "object" specify the desired path and file name.
//The file name must end with .m3u8!
const init = {
method: 'POST',
headers,
body
};
fetch('https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/start', init) //Replace {your_owner_ID} and {stream_id} with your details
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/start' #Replace {your_owner_ID} and {stream_id} with your details
headers = {'Content-Type': 'application/json','Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
body = """{
"path": "/container/{your_owner_ID}/object/path/to/file.m3u8",
"email": "your@email.com",
"max_dur": 3600,
"stop_timeout": 600,
"events_record": false
}"""
#Replace {your_owner_ID} with yours. After "object" specify the desired path and file name.
#The file name must end with .m3u8!
req = requests.post(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5c8d5174534b4427730ebf7f",
"name": "new_stream_name",
"src": "https://example.com/playlist.m3u8",
"instant_record_id": "5c8fbca0c1d1150001f7db76"
}
Stop instant stream recording
Description | Method for stopping instant stream recording |
URL structure | https://rec.platformcraft.ru/{owner_ID}/{stream_id}/stop |
Method | POST |
Request body type application | - |
Returns | Information about stream |
Request example
https://rec.platformcraft.ru/56bdf4a53f4f716301b09ba3/5c8d5174534b4427730ebf7f/stop
curl "https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/stop" \
-X POST \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'POST',
headers
};
fetch('https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/stop', init) //Replace {your_owner_ID} and {stream_id} with your details
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/stop' #Replace {your_owner_ID} and {stream_id} with your details
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.post(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5c8fbca0c1d1150001f7db76",
"src": "https://example.com/playlist.m3u8",
"files": ["5c8fbca0d2901f0007ccfbe3"], // id of recorded video files
"start": 1552923808, // time stamp start recording
"stop": 1552925156, // time stamp recording stop
"max_dur": 3600,
"status": "finish", // status of record
"msg": "", // error information (only in case of write errors)
"email": "test@test.te",
"is_instant": true, // instant recording or not
"stop_timeout": 600,
"events_record": true // recording events or not (see Description of the events_record parameter in "Starting instant recording of a stream")
}
Creating a schedule recording
Description | Method for creating hls stream record on schedule |
URL structure | https://rec.platformcraft.ru/{owner_ID}/{stream_id}/record |
Method | POST |
Request body type application | application/json |
Returns | Information about stream record |
Parameteres | |
Required: | |
path | path of the created video file in the format "/container/{owner_ID}/object{object_path} |
start | time stamp to start recording |
stop | time stamp to stop recording |
Optional: | |
client's email. If an email is specified, notifications about the recording status will be sent to it (only in case of problems with the stream) | |
max_dur | maximum duration of the recorded video file in seconds (default max_dur=2592000, i.e. 30 days). If the recording duration exceeds max_dur, then only the last max_dur seconds of recording will be recorded in the video file. For example: max_dur = 3600, the recording time was 7200 seconds (2 hours). The video file will contain only the last hour of recording. |
stop_timeout | record stop timeout in seconds (default is 1800, i.e. 30 minutes). If motion_record = true, then recording to the video file will take place within stop_timeout seconds after receiving the last picture via ftp server (see motion_record parameter). If motion_record = false, in case the stream will not be writable within stop_timeout seconds, the recording will be stopped (if events_record = false) or recording will be stopped in the video file (if events_record = true). |
motion_record | boolean type parameter (false by default). Motion Recording. It takes precedence over the events_record parameter. For motion recording, you need to connect the camera software to the ftp server at rec.platformcraft.ru. If true, then the stream recording will start at the moment when the picture is sent to the ftp server. Recording to the newly created file will stop after stop_timeout seconds have passed after the last picture was received. As soon as a new ftp picture arrives, a new video file is created and recording continues. |
events_record | boolean type parameter (false by default). Event recording stream. If false, then in case of recording problems within stop_timeout seconds, the recording will be disabled completely. If true, then in case of recording problems within stop_timeout seconds, recording of the stream to the video file will end, then recording will continue, waiting for the stream to resume. As soon as the stream becomes available again, a new event video file will be created. Etc. |
Request example
https://rec.platformcraft.ru/56bdf4a53f4f716301b09ba3/5c8d5174534b4427730ebf7f/record
curl "https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record" \
-X POST \
-d "{\n \"path\": \"/container/{your_owner_ID}/object/path/to/file.m3u8\",\n \"start\": {unix_start_time},\n \"stop\": {unix_stop_time}\n}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const body = `{
"path": "/container/{your_owner_ID}/object/path/to/file.m3u8",
"start": {unix_start_time},
"stop": {unix_stop_time}
}`;
//Additional parameters:
//email - to send notifications in case of problems with the stream.
//max_dur - the stream will be constantly recorded within the specified time window (DVR). The time is indicated in seconds.
//stop_timeout - a window during which the recorder waits for the stream problems to be fixed. After expiration, recording stops. The default is 30 minutes. The time is indicated in seconds.
//events_record - used for event recording, i.e. when the stream starts publishing. Recording stops after the broadcast ends and stop_timeout expires.
const init = {
method: 'POST',
headers,
body
};
fetch('https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record', init) //Replace {your_owner_ID} and {stream_id} with your details
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record' #Replace {your_owner_ID} and {stream_id} with your details
headers = {'Content-Type': 'application/json','Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
body = """{
"path": "/container/{your_owner_ID}/object/path/to/file.m3u8",
"start": {unix_start_time},
"stop": {unix_stop_time}
}"""
#Additional parameters:
#email - to send notifications in case of problems with the stream.
#max_dur - the stream will be constantly recorded within the specified time window (DVR). The time is indicated in seconds.
#stop_timeout - a window during which the recorder waits for the stream problems to be fixed. After expiration, recording stops. The default is 30 minutes. The time is indicated in seconds.
#events_record - used for event recording, i.e. when the stream starts publishing. Recording stops after the broadcast ends and stop_timeout expires.
req = requests.post(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5cc440f0534b4412ae69d6e3",
"src": "https://example.com/playlist.m3u8",
"files": null, // array of id of created video files
"start": 1556304586,
"stop": 1556305586,
"max_dur": 3600,
"status": "wait", // record status (wait - waiting, progress - execution, finish - recording completed, error - an error occurred)
"msg": "", // recording service message (in case of error)
"email": "test@test.te",
"is_instant": false, // is_instant = true - instant recording, is_instant = false - scheduled recording
"stop_timeout": 600,
"motion_record": true,
"events_record": false
}
Changing a record on schedule
Description | Method for changing hls stream record on schedule |
URL structure | URL: https://rec.platformcraft.ru/{owner_ID}/{stream_id}/record/{record_id} |
Method | PUT |
Request body type application | application/json |
Returns | Information about stream record |
Note | Only records with the status "wait" are allowed to change |
Request body options (all optional) | |
start | time stamp to start recording |
stop | time stamp to stop recording |
max_dur | maximum duration of the recorded video file in seconds |
client's email |
Request example
https://rec.platformcraft.ru/56bdf4a53f4f716301b09ba3/5c8d5174534b4427730ebf7f/record/5cc440f0534b4412ae69d6e3
Request body example
{
"path": "/container/567687df4f60c8cc3145cc03/object/test/test_2.m3u8",
"start": 1556305586,
"stop": 1556306586,
}
curl "https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}" \
-X PUT \
-d "{\n \"path\": \"/container/{your_owner_ID}/path/to/file.m3u8\",\n \"start\": {unix_start_time},\n \"stop\": {unix_stop_time},\n \"email\": \"test@test.ru\"\n}" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('Authorization', 'Bearer {your_access_token}');
const body = `{
"path": "/container/{your_owner_ID}/path/to/file.m3u8",
"start": {unix_start_time},
"stop": {unix_stop_time},
"email": "test@test.ru"
}`;
//Additional parameters:
//max_dur - max_dur - the stream will be constantly recorded within the specified time window (DVR). The time is indicated in seconds.
//stop_timeout - a window during which the recorder waits for the stream problems to be fixed. After expiration, recording stops. The default is 30 minutes. The time is indicated in seconds.
//events_record - used for event recording, i.e. when the stream starts publishing. Recording stops after the broadcast ends and stop_timeout expires.
const init = {
method: 'PUT',
headers,
body
};
fetch('https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}', init) //Replace {your_owner_ID} and {stream_id} with your details
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}' #Replace {your_owner_ID} and {stream_id} with your details
headers = {'Content-Type': 'application/json','Authorization': 'Bearer {your_access_token}'}
body = """{
"path": "/container/{your_owner_ID}/path/to/file.m3u8",
"start": {unix_start_time},
"stop": {unix_stop_time},
"email": "test@test.ru"
}"""
#Additional parameters:
#max_dur - the stream will be constantly recorded within the specified time window (DVR). The time is indicated in seconds.
#stop_timeout - a window during which the recorder waits for the stream problems to be fixed. After expiration, recording stops. The default is 30 minutes. The time is indicated in seconds.
#events_record - used for event recording, i.e. when the stream starts publishing. Recording stops after the broadcast ends and stop_timeout expires.
req = requests.put(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5cc440f0534b4412ae69d6e3",
"src": "https://example.com/playlist.m3u8",
"files": null, // array of id of created video files
"start": 1556305586,
"stop": 1556306586,
"max_dur": 3600,
"status": "wait", // record status (wait - waiting, progress - execution, finish - recording completed, error - an error occurred)
"msg": "", // recording service message (in case of error)
"email": "test@test.te",
"is_instant": false, // is_instant = true - instant recording, is_instant = false - scheduled recording
"stop_timeout": 600,
"motion_record": true,
"events_record": false
}
Getting a list of stream records
Description | Method for getting a list of stream records |
URL structure | https://rec.platformcraft.ru/{owner_ID}/{stream_id}/record |
Method | GET |
Request body type application | - |
Returns | List of Stream Records |
Request example
https://rec.platformcraft.ru/56bdf4a53f4f716301b09ba3/5c8d5174534b4427730ebf7f/record
curl "https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}" \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'GET',
headers
};
fetch('https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}', init) //Replace {your_owner_ID}, {stream_id} and {stream_id} with your details
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}' #Replace {your_owner_ID}, {stream_id} and {stream_id} with your details
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.get(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5cc440f0534b4412ae69d6e3",
"src": "https://example.com/playlist.m3u8",
"files": null, // array of id of created video files
"start": 1556305586,
"stop": 1556306586,
"max_dur": 3600,
"status": "wait", // record status (wait - waiting, progress - execution, finish - recording completed, error - an error occurred)
"msg": "", // recording service message (in case of error)
"email": "test@test.te",
"is_instant": false, // is_instant = true - instant recording, is_instant = false - scheduled recording
"stop_timeout": 600,
"motion_record": true,
"events_record": false
}
Getting information about record
Description | Method for getting information about record by id |
URL structure | https://rec.platformcraft.ru/{owner_ID}/{stream_id}/record/{record_id} |
Method | GET |
Request body type application | - |
Returns | Information about stream record |
Request example
https://rec.platformcraft.ru/56bdf4a53f4f716301b09ba3/5c8d5174534b4427730ebf7f/record/5cc440f0534b4412ae69d6e3
curl "https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}" \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'GET',
headers
};
fetch('https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}', init) //Replace {your_owner_ID}, {stream_id} and {stream_id} with your details
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}' #Replace {your_owner_ID}, {stream_id} and {stream_id} with your details
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.get(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5cc440f0534b4412ae69d6e3",
"src": "https://example.com/playlist.m3u8",
"files": null, // array of id of created video files
"start": 1556305586,
"stop": 1556306586,
"max_dur": 3600,
"status": "wait", // record status (wait - waiting, progress - execution, finish - recording completed, error - an error occurred)
"msg": "", // recording service message (in case of error)
"email": "test@test.te",
"is_instant": false, // is_instant = true - instant recording, is_instant = false - scheduled recording
"stop_timeout": 600,
"motion_record": true,
"events_record": false
}
Delete stream record
Description | Method for deleting stream record |
URL structure | https://rec.platformcraft.ru/{owner_ID}/{stream_id}/record/5cc440f0534b4412ae69d6e3 |
Method | DELETE |
Request body type application | - |
Returns | - |
curl "https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}" \
-X DELETE \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'DELETE',
headers
};
fetch('https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}', init) //Replace {your_owner_ID}, {stream_id} and {stream_id} with your details
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}' #Replace {your_owner_ID}, {stream_id} and {stream_id} with your details
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.delete(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Stop stream record
Description | Method for stopping stream record |
URL structure | https://rec.platformcraft.ru/{owner_ID}/{stream_id}/record/{record_id}/stop |
Method | POST |
Request body type application | - |
Returns | Information about record |
Request example
https://rec.platformcraft.ru/56bdf4a53f4f716301b09ba3/5c8d5174534b4427730ebf7f/record/5cc440f0534b4412ae69d6e3/stop
curl "https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}/stop" \
-X POST \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'POST',
headers
};
fetch('https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}/stop', init) //Replace {your_owner_ID}, {stream_id} and {stream_id} with your details
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://rec.platformcraft.ru/{your_owner_ID}/{stream_id}/record/{record_id}/stop' #Replace {your_owner_ID}, {stream_id} and {stream_id} with your details
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.post(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5cc440f0534b4412ae69d6e3",
"src": "https://example.com/playlist.m3u8",
"files": ["5c8fbca0d2901f0007ccfbe3"],
"start": 1556305586,
"stop": 1556306586,
"max_dur": 3600,
"status": "finish",
"msg": "",
"email": "test@test.te",
"is_instant": false,
"stop_timeout": 600,
"motion_record": true,
"events_record": false
}
Streamer (playout)
https://streamer.platformcraft.ru/2/streams/
Creating a channel
Description | Method of creating a channel |
Structure URL | https://streamer.platformcraft.ru/2/streams/{owner_ID} |
Method | POST |
Request body type | application/json |
Returns | Information about created channel |
Request example
https://streamer.platformcraft.ru/2/streams/56bdf4a53f4f716301b09ba3
Request body example
{
"name": "channel_name", # channel name (required parameter)
"qualities": ["360p", "480p"], # array of channel qualities (required parameter). Possible values: "360p", "480p", "720p", "1080p", "2160p".
"gag": { # gag (optional). Arrays of id files must be specified for each quality. File formats in gag should match the quality of the channel.
"360p": ["5e37d3ef534b444004244ebc"],
"480p": ["5d5450de534b447a006cb748"]
},
"rtmp_publish": { # rtmp-publish parameters (optional)
"stream_name": "stream_name", # stream name (required parameter)
"url": "rtmp://test1.publish.com", # URL of the main publishing server (required parameter)
"url_backup": "rtmp://test2.publish.com", # URL of the backup publishing server (optional)
"active": true # activate (true)/deactivate (false) rtmp-publish
}
}
curl "https://streamer.platformcraft.ru/2/streams/{your_owner_ID}" \
-X POST \
-d "{\n \"name\": \"{playlist_name}\", \n \"qualities\": [\"360p\", \"480p\"] \n}" \
-H "Authorization: Bearer {your_access_token}" \
-H "Content-Type: application/json"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}');
headers.append('Content-Type', 'application/json');
const body = `{
"name": "{playlist_name}",
"qualities": ["360p", "480p"]
}`;
//Add gag parameters and URL of the receiving RTMP server if needed
const init = {
method: 'POST',
headers,
body
};
fetch('https://streamer.platformcraft.ru/2/streams/{your_owner_ID}', init) //Please use {your_owner_ID}
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://streamer.platformcraft.ru/2/streams/{your_owner_ID}' #Please use {your_owner_ID}
headers = {'Authorization': 'Bearer {your_access_token}','Content-Type': 'application/json'} #Вместо {your_access_token} укажите свои данные
body = """{
"name": "{channel_name}",
"qualities": ["360p", "480p"]
}"""
#Add gag parameters and URL of the receiving RTMP server if needed
req = requests.post(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5ebbeb54534b447a810c52db", # channel id
"name": "channel_name", # channel name
"qualities": ["360p","480p"], # channel quality
"gag": { # gag
"duration": 9, # gag duration
"items": { # gag files
"360p": ["5e37d3ef534b444004244ebc"],
"480p": ["5d5450de534b447a006cb748"]
}
},
"rtmp_publish": { # rtmp-publish settings
"url": "rtmp://test1.publish.com", # url of the main publishing server
"url_backup": "rtmp://test2.publish.com", # url of the backup publishing server
"stream_name": "stream_name", # stream name
"active": true # activate/deactivate
}
}
Getting channel list
Description | Method of getting channel list |
Structure URL | https://streamer.platformcraft.ru/2/streams/{owner_ID} |
Method | GET |
Request body type | - |
Returns | Information about channels |
Request example
https://streamer.platformcraft.ru/2/streams/56bdf4a53f4f716301b09ba3
curl "https://streamer.platformcraft.ru/2/streams/{your_owner_ID}" \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'GET',
headers
};
fetch('https://streamer.platformcraft.ru/2/streams/{your_owner_ID}', init) //Use your {your_owner_ID}
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://streamer.platformcraft.ru/2/streams/{your_owner_ID}' #Use your {your_owner_ID}
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.get(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
[
{
"id": "5ebbeb54534b447a810c52db", # channel id
"name": "channel_name", # channel name
"qualities": ["360p","480p"], # channel quality
"gag": { # gag
"duration": 9, # gag duration
"items": { # gag files
"360p": ["5e37d3ef534b444004244ebc"],
"480p": ["5d5450de534b447a006cb748"]
}
},
"rtmp_publish": { # rtmp-publish settings
"url": "rtmp://test1.publish.com", # url of the main publishing server
"url_backup": "rtmp://test2.publish.com", # url of the backup publishing server
"stream_name": "stream_name", # stream name
"active": true # activate/deactivate
}
}
]
Getting information about channel
Description | Method of getting information about one channel |
Structure URL | https://streamer.platformcraft.ru/2/streams/{owner_ID}/{channel_id} |
Method | GET |
Request body type | - |
Returns | Information about channel |
Request example
https://streamer.platformcraft.ru/2/streams/56bdf4a53f4f716301b09ba3/5ebbeb54534b447a810c52db
curl "https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}" \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'GET',
headers
};
fetch('https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}', init) //Replace {your_owner_ID} and {channel_id} with your details
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}' #Replace {your_owner_ID} and {channel_id} with your details
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.get(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5ebbeb54534b447a810c52db", # channel id
"name": "channel_name", # channel name
"qualities": ["360p","480p"], # channel quality
"gag": { # gag
"duration": 9, # gag duration
"items": { # gag files
"360p": ["5e37d3ef534b444004244ebc"],
"480p": ["5d5450de534b447a006cb748"]
}
},
"rtmp_publish": { # rtmp-publish settings
"url": "rtmp://test1.publish.com", # url of the main publishing server
"url_backup": "rtmp://test2.publish.com", # url of the backup publishing server
"stream_name": "stream_name", # stream name
"active": true # activate/deactivate
}
}
Changing channel
Description | Method of changing channel |
Structure URL | https://streamer.platformcraft.ru/2/streams/{owner_ID}/{channel_id} |
Method | PUT |
Request body type | application/json |
Returns | Information of channel |
Note | Only changeable fields should be specified in request body |
Request example
https://streamer.platformcraft.ru/2/streams/56bdf4a53f4f716301b09ba3/5ebbeb54534b447a810c52db
Request body example
{
"name": "new_channel_name", # channel name
"gag": { # gag
"360p": ["5e37d3ef534b444004244ebc"],
"480p": ["5d5450de534b447a006cb748"]
},
"rtmp_publish": { # rtmp-publish parameters
"stream_name": "stream_name",
"url": "rtmp://test1.publish.com",
"url_backup": "rtmp://test2.publish.com",
"active": true
}
}
curl "https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}" \
-X PUT \
-d "{\n \"name\": \"new_channel_name\"\n}" \
-H "Authorization: Bearer {your_access_token}" \
-H "Content-Type: application/json"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
headers.append('Content-Type', 'application/json');
const body = `{
"name": "new_channel_name"
}`;
//Add gag parameters and URL of the receiving RTMP server if needed
const init = {
method: 'PUT',
headers,
body
};
fetch('https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}', init) //Replace {your_owner_ID} and {channel_id} with your own values
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}' #Replace {your_owner_ID} and {channel_id} with your own values
headers = {'Authorization': 'Bearer {your_access_token}','Content-Type': 'application/json'} #Please use your {your_access_token}
body = """{
"name": "new_channel_name"
}"""
#Add gag parameters and URL of the receiving RTMP server if needed
req = requests.put(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
"id": "5ebbeb54534b447a810c52db", # channel id
"name": "channel_name", # channel name
"qualities": ["360p","480p"], # channel quality
"gag": { # gag
"duration": 9, # gag duration
"items": { # gag files
"360p": ["5e37d3ef534b444004244ebc"],
"480p": ["5d5450de534b447a006cb748"]
}
},
"rtmp_publish": { # rtmp-publish settings
"url": "rtmp://test1.publish.com", # url of the main publishing server
"url_backup": "rtmp://test2.publish.com", # url of the backup publishing server
"stream_name": "stream_name", # stream name
"active": true # activate/deactivate
}
}
Deleting channel
Description | Method of deleting channel |
Structure URL | https://streamer.platformcraft.ru/2/streams/{owner_ID}/{channel_id} |
Method | DELETE |
Request body type | - |
Returns | - |
curl "https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}" \
-X DELETE \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'DELETE',
headers
};
fetch('https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}', init) //Replace {your_owner_ID} and {channel_id} with your own values
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}' #Replace {your_owner_ID} and {channel_id} with your own values
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.delete(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Media blocks
Creating media block
Description | Method of creating media block (without publishing on the air) |
Structure URL | https://streamer.platformcraft.ru/2/streams/{owner_ID}/{channel_id}/block |
Method | POST |
Request body type | application/json |
Returns | Information about created media block |
Request example
https://streamer.platformcraft.ru/2/streams/56bdf4a53f4f716301b09ba3/5ebbeb54534b447a810c52db/block
Request body example
{
"name": "block_name", # media block name
"timestamp": 1589407535, # timestamp of starting media block (required parameter)
"loop": true, # play media block in a circle
"items": { # files (required parameter). Dictionary of the kind {"quality": [array of video files id]}. Files must be specified for each channel quality. Durations of video files with the same serial number in arrays must match.
"360p": ["5e37d3ef534b444004244ebc","5e37d3ef534b444004244ebd"],
"480p": ["5d5450de534b447a006cb748","5d5450de534b447a006cb749"]
},
"status": "ready" # media block status. Possible values: "ready" (block is ready for publishing and will be checked for data valadity) and "not ready" (block is not ready for publishing and will not be checked for data valadity).
}
curl "https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block" \
-X POST \
-d "{\n \"name\": \"block_name\", \n \"timestamp\": 1589407535, \n \"loop\": true, \n \"items\": { \n \"360p\": [\"5e37d3ef534b444004244ebc\",\"5e37d3ef534b444004244ebd\"],\n \"480p\": [\"5d5450de534b447a006cb748\",\"5d5450de534b447a006cb749\"]\n },\n \"status\": \"ready\"\n}" \
-H "Authorization: Bearer {your_access_token}" \
-H "Content-Type: application/json"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
headers.append('Content-Type', 'application/json');
const body = `{
"name": "{block_name}",
"timestamp": {unix_start_time},
"loop": true,
"items": {
"360p": ["{video_id_1}","{video_id_2}"],
"480p": ["{video_id_1}","{video_id_2}"]
},
"status": "ready"
}`;
//Substitute your values in place of the values in curly braces
const init = {
method: 'POST',
headers,
body
};
fetch('https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block', init) //Replace {your_owner_ID} and {channel_id} with your own values
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block' #Replace {your_owner_ID} and {channel_id} with your own values
headers = {'Authorization': 'Bearer {your_access_token}','Content-Type': 'application/json'} #Please use your {your_access_token}
body = """{
"name": "block_name",
"timestamp": {unix_start_time},
"loop": true,
"items": {
"360p": ["{video_id_1}","{video_id_2}"],
"480p": ["{video_id_1}","{video_id_2}"]
},
"status": "ready"
}"""
#Substitute your values in place of the values in curly braces
req = requests.post(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
id: "5ebc6f3d534b44024f51d456", # media block id
name: "block_name",
channel_id: "5ebbedf6534b44024f51d453", # channel id
duration: 235, # media block duration (calculated only for a block with status "ready")
items: { # files
"360p": ["5e37d3ef534b444004244ebc","5e37d3ef534b444004244ebd"],
"480p": ["5d5450de534b447a006cb748","5d5450de534b447a006cb749"]
},
loop: true, # loop
status: "ready", # status
timestamp: 1589407535, # timestamp of starting media block
stop_ts: 1589407770 # timestamp of ending media block
}
Changing media block
Description | Method of changing media block |
Structure URL | https://streamer.platformcraft.ru/2/streams/{owner_ID}/{channel_id}/block/{block_id} |
Method | PUT |
Request body type | application/json |
Returns | Information of changed media block |
Note | It is forbidden to change media blocks with status "start" or "wait". Only changeable fields should be specified in request body. |
Request example
https://streamer.platformcraft.ru/2/streams/56bdf4a53f4f716301b09ba3/5ebbeb54534b447a810c52db/block/5ebc6f3d534b44024f51d456
Request body example
{
"name": "new_block_name", # media block name
"timestamp": 1589407536, # timestamp of starting media block (required parameter)
"loop": true, # play media block in a circle
"items": { # files (required parameter). Dictionary of the kind {"quality": [array of video files id]}. Files must be specified for each channel quality. Durations of video files with the same serial number in arrays must match.
"360p": ["5e37d3ef534b444004244ebc","5e37d3ef534b444004244ebd"],
"480p": ["5d5450de534b447a006cb748","5d5450de534b447a006cb749"]
},
"status": "ready" # media block status. Possible values: "ready" (block is ready for publishing and will be checked for data valadity) and "not ready" (block is not ready for publishing and will not be checked for data valadity).
}
curl "https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}" \
-X PUT \
-d "{\n \"name\": \"new_block_name\"\n}" \
-H "Authorization: Bearer {your_access_token}" \
-H "Content-Type: application/json"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
headers.append('Content-Type', 'application/json');
const body = `{
"name": "new_block_name"
}`;
//Add other parameters as needed
const init = {
method: 'PUT',
headers,
body
};
fetch('https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}', init) //Replace {your_owner_ID}, {channel_id} and {block_id} with your own values
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}' #Replace {your_owner_ID}, {channel_id} and {block_id} with your own values
headers = {'Authorization': 'Bearer {your_access_token}','Content-Type': 'application/json'} #Please use your {your_access_token}
body = """{
"name": "new_block_name"
}"""
#Add other parameters as needed
req = requests.put(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
id: "5ebc6f3d534b44024f51d456", # media block id
name: "new_block_name",
channel_id: "5ebbedf6534b44024f51d453", # channel id
duration: 235, # media block duration (calculated only for a block with status "ready")
items: { # files
"360p": ["5e37d3ef534b444004244ebc","5e37d3ef534b444004244ebd"],
"480p": ["5d5450de534b447a006cb748","5d5450de534b447a006cb749"]
},
loop: true, # loop
status: "ready", # status
timestamp: 1589407536, # timestamp of starting media block
stop_ts: 1589407770 # timestamp of ending media block
}
Getting media block list
Description | Method of getting media block list |
Structure URL | https://streamer.platformcraft.ru/2/streams/{owner_ID}/{channel_id}/block |
Method | GET |
Request body type | - |
Returns | Media block list of the channel |
Request example
https://streamer.platformcraft.ru/2/streams/56bdf4a53f4f716301b09ba3/5ebbeb54534b447a810c52db/block
curl "https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block" \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'GET',
headers
};
fetch('https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block', init) //Replace {your_owner_ID} and {channel_id} with your own values
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block' #Replace {your_owner_ID} and {channel_id} with your own values
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.get(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
[
{
id: "5ebc6f3d534b44024f51d456", # media block id
name: "block_name",
channel_id: "5ebbedf6534b44024f51d453", # channel id
duration: 235, # media block duration (calculated only for a block with status "ready")
items: { # files
"360p": ["5e37d3ef534b444004244ebc","5e37d3ef534b444004244ebd"],
"480p": ["5d5450de534b447a006cb748","5d5450de534b447a006cb749"]
},
loop: true, # loop
status: "ready", # status
timestamp: 1589407536, # timestamp of starting media block
stop_ts: 1589407770 # timestamp of ending media block
}
]
Getting information about media block
Description | Method for getting information about media block |
Structure URL | https://streamer.platformcraft.ru/2/streams/{owner_ID}/{channel_id}/block/{block_id} |
Method | GET |
Request body type | - |
Returns | Information about media block |
Request example
https://streamer.platformcraft.ru/2/streams/56bdf4a53f4f716301b09ba3/5ebbeb54534b447a810c52db/block/5ebc6f3d534b44024f51d456
curl "https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}" \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'GET',
headers
};
fetch('https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}', init) //Replace {your_owner_ID}, {channel_id} and {block_id} with your own values
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}' #Replace {your_owner_ID}, {channel_id} and {block_id} with your own values
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.get(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
{
id: "5ebc6f3d534b44024f51d456", # media block id
name: "block_name",
channel_id: "5ebbedf6534b44024f51d453", # channel id
duration: 235, # media block duration (calculated only for a block with status "ready")
items: { # files
"360p": ["5e37d3ef534b444004244ebc","5e37d3ef534b444004244ebd"],
"480p": ["5d5450de534b447a006cb748","5d5450de534b447a006cb749"]
},
loop: true, # loop
status: "ready", # status
timestamp: 1589407536, # timestamp of starting media block
stop_ts: 1589407770 # timestamp of ending media block
}
Deleting media block
Description | Method for deleting media block |
Structure URL | https://streamer.platformcraft.ru/2/streams/{owner_ID}/{channel_id}/block/{block_id} |
Method | DELETE |
Request body type | - |
Returns | - |
curl "https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}" \
-X DELETE \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'DELETE',
headers
};
fetch('https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}', init) //Replace {your_owner_ID}, {channel_id} and {block_id} with your own values
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}' #Replace {your_owner_ID}, {channel_id} and {block_id} with your own values
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.delete(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Instant start of media block
Description | Method of instant start media block |
Structure URL | https://streamer.platformcraft.ru/2/streams/{owner_ID}/{channel_id}/block/{block_id}/start |
Method | POST |
Request body type | - |
Returns | - |
Note | Media block must be ready for publishing (status != "not ready"). If there is already another media block on the air at the moment of instant start media block, than the started media block will replace the old one from the air. |
curl "https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}/start" \
-X POST \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', '{your_access_token}'); //Please use {your_access_token}
const init = {
method: 'POST',
headers
};
fetch('https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}/start', init) //Replace {your_owner_ID}, {channel_id} and {block_id} with your own values
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}/start' #Replace {your_owner_ID}, {channel_id} and {block_id} with your own values
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use {your_access_token}
req = requests.post(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Stop media block
Description | Method for the forced stop media block |
Structure URL | https://streamer.platformcraft.ru/2/streams/{owner_ID}/{channel_id}/block/{block_id}/stop |
Method | POST |
Request body type | - |
Returns | - |
Note | If media block is on the air (status = "start") or in standby mode (status = "wait"), it will be removed from the air and its status will change to "finish". For other media block status values ("not ready", "ready", "finish") method is ignored. |
curl "https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}/stop" \
-X POST \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'POST',
headers
};
fetch('https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}/stop', init) //Replace {your_owner_ID}, {channel_id} and {block_id} with your own values
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}/stop' #Replace {your_owner_ID}, {channel_id} and {block_id} with your own values
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.post(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Publication of media block
Description | Method for publishing media block on the air |
Structure URL | https://streamer.platformcraft.ru/2/streams/{owner_ID}/{channel_id}/block/{block_id}/schedule |
Method | POST |
Request body type | - |
Returns | - |
Note | Media block must be ready for publishing (status != "not ready"). |
curl "https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}/schedule" \
-X POST \
-H "Authorization: Bearer {your_access_token}"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
const init = {
method: 'POST',
headers
};
fetch('https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}/schedule', init) //Replace {your_owner_ID}, {channel_id} and {block_id} with your own values
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}/schedule' #Replace {your_owner_ID}, {channel_id} and {block_id} with your own values
headers = {'Authorization': 'Bearer {your_access_token}'} #Please use your {your_access_token}
req = requests.post(url, headers=headers)
print(req.status_code)
print(req.headers)
print(req.text)
Copying media block
Description | Method for creating copies of media block |
Structure URL | https://streamer.platformcraft.ru/2/streams/{owner_ID}/{channel_id}/block/{block_id}/copy |
Method | POST |
Request body type | application/json |
Returns | List of copied media blocks |
Request example
https://streamer.platformcraft.ru/2/streams/56bdf4a53f4f716301b09ba3/5ebbeb54534b447a810c52db/block/5ebc6f3d534b44024f51d456/copy
Request body example
{
"name": "copy_block_name", # name of copied media blocks
"timestamps": [1589539452], # list of timestamps, corresponding to the beggining of the copied media blocks
"publish": false # publish or not copied media blocks
}
curl "https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}/copy" \
-X POST \
-d "{\n \"name\": \"{copy_block_name}\",\n \"timestamps\": [{unix_start_time}],\n \"publish\": false\n}" \
-H "Authorization: Bearer {your_access_token}" \
-H "Content-Type: application/json"
const headers = new Headers();
headers.append('Authorization', 'Bearer {your_access_token}'); //Please use your {your_access_token}
headers.append('Content-Type', 'application/json');
const body = `{
"name": "{copy_block_name}",
"timestamps": [{unix_start_time}],
"publish": false
}`;
//Substitute your values in place of the values in curly braces
const init = {
method: 'POST',
headers,
body
};
fetch('https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}/copy', init) //Replace {your_owner_ID}, {channel_id} and {block_id} with your own values
.then((response) => {
return response.json(); // or .text() or .blob() ...
})
.then((text) => {
// text is the response body
})
.catch((e) => {
// error in e.message
});
import requests
url = 'https://streamer.platformcraft.ru/2/streams/{your_owner_ID}/{channel_id}/block/{block_id}/copy' #Replace {your_owner_ID}, {channel_id} and {block_id} with your own values
headers = {'Authorization': 'Bearer {your_access_token}','Content-Type': 'application/json'} #Please use your {your_access_token}
body = """{
"name": "{copy_block_name}",
"timestamps": [{unix_start_time}],
"publish": false
}"""
#Substitute your values in place of the values in curly braces
req = requests.post(url, headers=headers, data=body)
print(req.status_code)
print(req.headers)
print(req.text)
Response example
[
{
id: "5ebc6f3d534b44024f51d457", # media block id
name: "new_block_name",
channel_id: "5ebbedf6534b44024f51d453", # channel id
duration: 235, # media block duration (calculated only for a block with status "ready")
items: { # files
"360p": ["5e37d3ef534b444004244ebc","5e37d3ef534b444004244ebd"],
"480p": ["5d5450de534b447a006cb748","5d5450de534b447a006cb749"]
},
loop: true, # loop
status: "ready", # status
timestamp: 1589539452, # timestamp of starting media block
stop_ts: 1589539687 # timestamp of ending media block
}
]