Configure Ad Server
Sets the upstream VAST/VMAP ad server URL, query parameters and custom origin headers. Triggers a stream-adserver provisioning job.
curl -X POST "https://api.5centscdn.com/v2/streams/pull/123/adinsertion/server" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"url": "https://adserver.example.com/vast.php",
"queryParameters": [
{
"name": "src_url",
"type": "from-variable",
"value": "SOURCE_URL"
},
{
"name": "break_dur",
"type": "from-variable",
"value": "ADBREAK_DURATION_S"
},
{
"name": "CACHE_BUSTER",
"type": "from-variable",
"value": "CACHE_BUSTER"
}
],
"adOrigin": {
"customHeaders": []
}
}'
import requests
import json
url = "https://api.5centscdn.com/v2/streams/pull/123/adinsertion/server"
headers = {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
data = {
"url": "https://adserver.example.com/vast.php",
"queryParameters": [
{
"name": "src_url",
"type": "from-variable",
"value": "SOURCE_URL"
},
{
"name": "break_dur",
"type": "from-variable",
"value": "ADBREAK_DURATION_S"
},
{
"name": "CACHE_BUSTER",
"type": "from-variable",
"value": "CACHE_BUSTER"
}
],
"adOrigin": {
"customHeaders": []
}
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.5centscdn.com/v2/streams/pull/123/adinsertion/server", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"url": "https://adserver.example.com/vast.php",
"queryParameters": [
{
"name": "src_url",
"type": "from-variable",
"value": "SOURCE_URL"
},
{
"name": "break_dur",
"type": "from-variable",
"value": "ADBREAK_DURATION_S"
},
{
"name": "CACHE_BUSTER",
"type": "from-variable",
"value": "CACHE_BUSTER"
}
],
"adOrigin": {
"customHeaders": []
}
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"url": "https://adserver.example.com/vast.php",
"queryParameters": [
{
"name": "src_url",
"type": "from-variable",
"value": "SOURCE_URL"
},
{
"name": "break_dur",
"type": "from-variable",
"value": "ADBREAK_DURATION_S"
},
{
"name": "CACHE_BUSTER",
"type": "from-variable",
"value": "CACHE_BUSTER"
}
],
"adOrigin": {
"customHeaders": []
}
}`)
req, err := http.NewRequest("POST", "https://api.5centscdn.com/v2/streams/pull/123/adinsertion/server", 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/server')
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 = '{
"url": "https://adserver.example.com/vast.php",
"queryParameters": [
{
"name": "src_url",
"type": "from-variable",
"value": "SOURCE_URL"
},
{
"name": "break_dur",
"type": "from-variable",
"value": "ADBREAK_DURATION_S"
},
{
"name": "CACHE_BUSTER",
"type": "from-variable",
"value": "CACHE_BUSTER"
}
],
"adOrigin": {
"customHeaders": []
}
}'
response = http.request(request)
puts response.body
{
"result": "success"
}
{
"result": "error",
"message": "Descriptive error message."
}
/streams/pull/{streamid}/adinsertion/serverTarget server for requests. Edit to use your own host.
API key (sent in header)
Numeric stream ID.
The media type of the request body
The VAST or VMAP ad server endpoint URL. This is the base URL the SSAI engine calls to fetch ad content during a live stream. Must be a valid HTTP/HTTPS URL.
A dynamic list of query parameters appended to every ad server request. Each entry has three fields: name (the parameter key), type (the value source), and value (the parameter value or source identifier).
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
The VAST or VMAP ad server endpoint URL. This is the base URL the SSAI engine calls to fetch ad content during a live stream. Must be a valid HTTP/HTTPS URL.
https://pubads.g.doubleclick.net/gampad/adsA dynamic list of query parameters appended to every ad server request. Each entry has three fields: name (the parameter key), type (the value source), and value (the parameter value or source identifier).
Controls where the parameter value comes from. custom: a static value you define manually. forward: forwards a parameter from the viewer's original playback request as-is. from-query-parameter: maps a viewer request parameter to a differently named ad server parameter. from-variable: populates the parameter with a server-side system variable (CLIENT_IP, CACHE_BUSTER, ADBREAK_DURATION_S, ADBREAK_DURATION_MS, UPID_ASCII, UPID_HEX, ADFR_FORMAT, ADFR_VERSION, ADFR_CHANNEL, ADFR_DATE, ADFR_CODE, ADFR_DURATION, CURRENT_SPOT_INDEX, SOURCE_URL). from-header: reads a value from an HTTP request header sent by the viewer.
customforwardfrom-variablefrom-headerfrom-query-parameterThe parameter value or source identifier. Required for all types. For custom: the literal string value. For forward and from-query-parameter: the source parameter name from the viewer request. For from-variable: one of the predefined system tokens (e.g. CLIENT_IP, CACHE_BUSTER). For from-header: the HTTP header name to read from.
CLIENT_IPA list of custom HTTP headers sent to the ad origin server with each ad request. Used to pass authentication tokens, platform identifiers, or metadata required by the ad server.
Responses
Status of the API response.
successerrorHuman-readable message describing the result.