Add Ad Break Schedule
Adds a new ad break schedule. Two schedule types are supported. Maximum 10 schedules per stream.
curl -X POST "https://api.5centscdn.com/v2/streams/pull/123/adinsertion/schedule" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"_METHOD": "PUT",
"type": 1,
"duration": 60,
"value": "0 */5 * * * *",
"mode": "schedule",
"recur": 1
}'
import requests
import json
url = "https://api.5centscdn.com/v2/streams/pull/123/adinsertion/schedule"
headers = {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
data = {
"_METHOD": "PUT",
"type": 1,
"duration": 60,
"value": "0 */5 * * * *",
"mode": "schedule",
"recur": 1
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.5centscdn.com/v2/streams/pull/123/adinsertion/schedule", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"_METHOD": "PUT",
"type": 1,
"duration": 60,
"value": "0 */5 * * * *",
"mode": "schedule",
"recur": 1
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"_METHOD": "PUT",
"type": 1,
"duration": 60,
"value": "0 */5 * * * *",
"mode": "schedule",
"recur": 1
}`)
req, err := http.NewRequest("POST", "https://api.5centscdn.com/v2/streams/pull/123/adinsertion/schedule", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.5centscdn.com/v2/streams/pull/123/adinsertion/schedule')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-API-Key'] = 'YOUR_API_KEY'
request.body = '{
"_METHOD": "PUT",
"type": 1,
"duration": 60,
"value": "0 */5 * * * *",
"mode": "schedule",
"recur": 1
}'
response = http.request(request)
puts response.body
{
"result": "success",
"message": "Added: 1, Failed: 151",
"messages": {
"added": {
"1778066400": 1370623
},
"failed": {
"1778066700": "Recur limit reached"
}
}
}
/streams/pull/{streamid}/adinsertion/scheduleTarget server for requests. Edit to use your own host.
API key (sent in header)
Numeric stream ID.
The media type of the request body
HTTP method override for this request. This endpoint accepts POST, but set this to PUT to perform an update operation.
Schedule type: 1 for Recurring, 2 for One-time.
Ad break duration in seconds.
Quartz cron expression (type 1) or Unix timestamp (type 2).
Pass schedule to immediately create triggers.
Maximum number of trigger repetitions. 0 means unlimited.
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. Provide your API key in the header.
Path Parameters
Numeric stream ID.
Body
HTTP method override for this request. This endpoint accepts POST, but set this to PUT to perform an update operation.
PUTResponses
Status of the API response.
successerrorSummary of added and failed trigger counts.
Informational messages related to the stream state.
Map of Unix timestamp to beanstalkd job ID.
Map of Unix timestamp to failure reason.