Content Management
Create a website
Create a website under your TargetVideo account.
Using the following API call you can create a website under your TargetVideo account. All your video content, players, ad tags and everything else will be organised under a specific website (domain) in TargetVideo so this would be the first step after you created an account with us.
POST https://api.target-video.com/apiv3/partner/add.json
Every request must send your API token in an Authorization: Bearer header — see API credentials.
Parameter name | Description | Required |
|---|---|---|
domain | Your website’s domain, e.g. | yes |
Examples
PHP
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.target-video.com/apiv3/partner/add.json",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => array('domain' => 'www.test-add.com'),
CURLOPT_HTTPHEADER => array(
"Authorization: Bearer YOUR_API_TOKEN"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Java
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("domain", "www.test-add.com")
.build();
Request request = new Request.Builder()
.url("https://api.target-video.com/apiv3/partner/add.json")
.method("POST", body)
.addHeader("Authorization", "Bearer YOUR_API_TOKEN")
.build();
Response response = client.newCall(request).execute();
JavaScript
var https = require('follow-redirects').https;
var fs = require('fs');
var options = {
'method': 'POST',
'hostname': 'api.target-video.com',
'path': '/apiv3/partner/add.json',
'headers': {
'Authorization': 'Bearer YOUR_API_TOKEN'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = "------WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-data; name=\"domain\"\r\n\r\nwww.test-add.com\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--";
req.setHeader('content-type', 'multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW');
req.write(postData);
req.end();
Ruby
require "uri"
require "net/http"
url = URI("https://api.target-video.com/apiv3/partner/add.json")
https = Net::HTTP.new(url.host, url.port);
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer YOUR_API_TOKEN"
form_data = [['domain', 'www.test-add.com']]
request.set_form form_data, 'multipart/form-data'
response = https.request(request)
puts response.read_body
On success the response contains "status": true, the message Partner has been saved. and the new website’s id — the partner_id you use in the other API calls. If the domain is missing, invalid, an IP address or already registered, the request fails with HTTP 400 and errors.validation.domain says why.