Enable Ad Insertion
Creates (or updates) the ad insertion record for the push stream. Requires the service to have Advanced Features enabled and an available ad insertion slot.
curl -X PUT "https://api.5centscdn.com/v2/streams/push/123/adinsertion" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"enabled": "Y",
"policy": 1,
"provider": "Google Ad Manager",
"defaultDuration": 30
}'
import requests
import json
url = "https://api.5centscdn.com/v2/streams/push/123/adinsertion"
headers = {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
data = {
"enabled": "Y",
"policy": 1,
"provider": "Google Ad Manager",
"defaultDuration": 30
}
response = requests.put(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.5centscdn.com/v2/streams/push/123/adinsertion", {
method: "PUT",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"enabled": "Y",
"policy": 1,
"provider": "Google Ad Manager",
"defaultDuration": 30
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"enabled": "Y",
"policy": 1,
"provider": "Google Ad Manager",
"defaultDuration": 30
}`)
req, err := http.NewRequest("PUT", "https://api.5centscdn.com/v2/streams/push/123/adinsertion", 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/push/123/adinsertion')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Put.new(uri)
request['Content-Type'] = 'application/json'
request['X-API-Key'] = 'YOUR_API_KEY'
request.body = '{
"enabled": "Y",
"policy": 1,
"provider": "Google Ad Manager",
"defaultDuration": 30
}'
response = http.request(request)
puts response.body
{
"result": "success"
}
{
"result": "error",
"message": "Descriptive error message."
}
/streams/push/{streamid}/adinsertionTarget server for requests. Edit to use your own host.
API key (sent in header)
Numeric stream ID.
The media type of the request body
Enable or disable ad insertion on the stream.
Ad insertion policy: 1 is Provider-based, 2 is No provider.
Required when policy is 1. Provider identifier.
Default ad break duration in seconds.
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
Required when policy is 1. Provider identifier.
Default ad break duration in seconds.
Responses
Status of the API response.
successerrorHuman-readable message describing the result.