Create broadcast
curl --request POST \
--url https://api.gcore.com/streaming/broadcasts \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"broadcast": {
"name": "Broadcast",
"status": "live",
"share_url": "",
"custom_iframe_url": "",
"show_dvr_after_finish": true,
"ad_id": 1,
"player_id": 14,
"stream_ids": [
10
]
}
}
'import requests
url = "https://api.gcore.com/streaming/broadcasts"
payload = { "broadcast": {
"name": "Broadcast",
"status": "live",
"share_url": "",
"custom_iframe_url": "",
"show_dvr_after_finish": True,
"ad_id": 1,
"player_id": 14,
"stream_ids": [10]
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
broadcast: {
name: 'Broadcast',
status: 'live',
share_url: '',
custom_iframe_url: '',
show_dvr_after_finish: true,
ad_id: 1,
player_id: 14,
stream_ids: [10]
}
})
};
fetch('https://api.gcore.com/streaming/broadcasts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/streaming/broadcasts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'broadcast' => [
'name' => 'Broadcast',
'status' => 'live',
'share_url' => '',
'custom_iframe_url' => '',
'show_dvr_after_finish' => true,
'ad_id' => 1,
'player_id' => 14,
'stream_ids' => [
10
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gcore.com/streaming/broadcasts"
payload := strings.NewReader("{\n \"broadcast\": {\n \"name\": \"Broadcast\",\n \"status\": \"live\",\n \"share_url\": \"\",\n \"custom_iframe_url\": \"\",\n \"show_dvr_after_finish\": true,\n \"ad_id\": 1,\n \"player_id\": 14,\n \"stream_ids\": [\n 10\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/streaming/broadcasts")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"broadcast\": {\n \"name\": \"Broadcast\",\n \"status\": \"live\",\n \"share_url\": \"\",\n \"custom_iframe_url\": \"\",\n \"show_dvr_after_finish\": true,\n \"ad_id\": 1,\n \"player_id\": 14,\n \"stream_ids\": [\n 10\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/streaming/broadcasts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"broadcast\": {\n \"name\": \"Broadcast\",\n \"status\": \"live\",\n \"share_url\": \"\",\n \"custom_iframe_url\": \"\",\n \"show_dvr_after_finish\": true,\n \"ad_id\": 1,\n \"player_id\": 14,\n \"stream_ids\": [\n 10\n ]\n }\n}"
response = http.request(request)
puts response.read_bodyThis response has no body data.This response has no body data.Broadcasts
Create broadcast
Broadcast entity is for setting up HTML video player, which serves to combine:
- many live streams,
- advertising,
- and design in one config.
If you use other players or you get streams by direct .m3u8/.mpd links, then you will not need this entity.
Scheme of “broadcast” entity using:

POST
/
streaming
/
broadcasts
Create broadcast
curl --request POST \
--url https://api.gcore.com/streaming/broadcasts \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"broadcast": {
"name": "Broadcast",
"status": "live",
"share_url": "",
"custom_iframe_url": "",
"show_dvr_after_finish": true,
"ad_id": 1,
"player_id": 14,
"stream_ids": [
10
]
}
}
'import requests
url = "https://api.gcore.com/streaming/broadcasts"
payload = { "broadcast": {
"name": "Broadcast",
"status": "live",
"share_url": "",
"custom_iframe_url": "",
"show_dvr_after_finish": True,
"ad_id": 1,
"player_id": 14,
"stream_ids": [10]
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
broadcast: {
name: 'Broadcast',
status: 'live',
share_url: '',
custom_iframe_url: '',
show_dvr_after_finish: true,
ad_id: 1,
player_id: 14,
stream_ids: [10]
}
})
};
fetch('https://api.gcore.com/streaming/broadcasts', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gcore.com/streaming/broadcasts",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'broadcast' => [
'name' => 'Broadcast',
'status' => 'live',
'share_url' => '',
'custom_iframe_url' => '',
'show_dvr_after_finish' => true,
'ad_id' => 1,
'player_id' => 14,
'stream_ids' => [
10
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gcore.com/streaming/broadcasts"
payload := strings.NewReader("{\n \"broadcast\": {\n \"name\": \"Broadcast\",\n \"status\": \"live\",\n \"share_url\": \"\",\n \"custom_iframe_url\": \"\",\n \"show_dvr_after_finish\": true,\n \"ad_id\": 1,\n \"player_id\": 14,\n \"stream_ids\": [\n 10\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gcore.com/streaming/broadcasts")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"broadcast\": {\n \"name\": \"Broadcast\",\n \"status\": \"live\",\n \"share_url\": \"\",\n \"custom_iframe_url\": \"\",\n \"show_dvr_after_finish\": true,\n \"ad_id\": 1,\n \"player_id\": 14,\n \"stream_ids\": [\n 10\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gcore.com/streaming/broadcasts")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"broadcast\": {\n \"name\": \"Broadcast\",\n \"status\": \"live\",\n \"share_url\": \"\",\n \"custom_iframe_url\": \"\",\n \"show_dvr_after_finish\": true,\n \"ad_id\": 1,\n \"player_id\": 14,\n \"stream_ids\": [\n 10\n ]\n }\n}"
response = http.request(request)
puts response.read_bodyThis response has no body data.This response has no body data.Authorizations
API key for authentication. Make sure to include the word apikey, followed by a single space and then your token.
Example: apikey 1234$abcdef
Body
application/json
Show child attributes
Show child attributes
Example:
{ "name": "Broadcast", "status": "live", "share_url": "", "custom_iframe_url": "", "show_dvr_after_finish": true, "ad_id": 1, "player_id": 14, "stream_ids": [10] }
Response
Was this page helpful?
⌘I