Upload a video file to an Advanced Local Video(s) banner
Adds a video to the banner's video files, as the console's Video files grid does: a multipart 'file', or a public http(s) 'url' the server downloads once.
Reference
POST https://YOUR-NETWORK-DOMAIN/rest-api/banner/{bannerId}/vast/media-files.do
Adds a video to the banner's video files, as the console's Video files grid does: a multipart 'file', or a public http(s) 'url' the server downloads once. Where the network compresses video creatives, 'scaleTo' picks the renditions to store (ORIGINAL, _1080P, _720P, _480P, _360P, _320P, _240P; ORIGINAL when none); otherwise the file is stored as uploaded. The network's video size limit applies. Needs the Advanced Local Video(s) permission and update rights on the banner's advertiser. Answers with the banner's video files and the ids of the new ones.
Path Params
bannerIdintegerrequired
Advanced Local Video(s) banner id
5001
Query Params
urlstring
Public http(s) link to the video; used when no file is sent
https://cdn.northwind.example/spring_30.mp4
scaleToarray<string>
Renditions to store where the network compresses video creatives
_720P
Body
A multipart form: file (file).
Responses
200
{bannerId, created:[ids], total, mediaFiles:[…]}; a rendition that failed while others were stored is named in 'msg'
400
No file or url, an unsupported or unreadable video, a refused link, or not an Advanced Local Video(s) banner
401
Authentication error
403
The Advanced Local Video(s) permission is off, or no update rights on the banner
import fs from 'node:fs/promises';
const form = new FormData();
form.append('file', new Blob([await fs.readFile('video.mp4')]), 'video.mp4');
const response = await fetch('https://YOUR-NETWORK-DOMAIN/rest-api/banner/5001/vast/media-files.do?url=https%3A%2F%2Fcdn.northwind.example%2Fspring_30.mp4&scaleTo=_720P', {
method: 'POST',
headers: { 'X-Api-Key': 'YOUR_API_KEY' },
body: form,
});
console.log(await response.json());
Java Request
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://YOUR-NETWORK-DOMAIN/rest-api/banner/5001/vast/media-files.do?url=https%3A%2F%2Fcdn.northwind.example%2Fspring_30.mp4&scaleTo=_720P"))
.header("X-Api-Key", "YOUR_API_KEY")
// multipart upload: build the body with your HTTP library of choice
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
C# Request
using var client = new HttpClient();
var request = new HttpRequestMessage(new HttpMethod("POST"), "https://YOUR-NETWORK-DOMAIN/rest-api/banner/5001/vast/media-files.do?url=https%3A%2F%2Fcdn.northwind.example%2Fspring_30.mp4&scaleTo=_720P");
request.Headers.Add("X-Api-Key", "YOUR_API_KEY");
var form = new MultipartFormDataContent();
form.Add(new ByteArrayContent(File.ReadAllBytes("video.mp4")), "file", "video.mp4");
request.Content = form;
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
Go Request
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("POST", "https://YOUR-NETWORK-DOMAIN/rest-api/banner/5001/vast/media-files.do?url=https%3A%2F%2Fcdn.northwind.example%2Fspring_30.mp4&scaleTo=_720P", nil)
req.Header.Set("X-Api-Key", "YOUR_API_KEY")
// multipart upload: build the body with mime/multipart
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}