
Three Simple Methods to Invoke the Vidispine API From .NET Code by Vidispine June 15, 2016 Howto
Binagora is on fire and returns with another guest post. We know we have a bunch of developers on .NET, therefore we created a .NET SDK. This post shows how you can invoke the Vidispine API from .NET, using the SDK or using standard .NET classes. All with example code.
The following article describe three simple ways to invoke the Vidispine API from .NET code. Two of them use standard .NET classes, while the last one uses the Vidispine .NET SDK. Code snippets were written using C# but you can of course use another language, such as VB.NET, if you want to.
We'll use the simplest test case possible, and let us retrieve the id of the first available item in the Vidispine library.
First of all, let's see how it's done in Postman. As you may already know, it's just a simple http GET request to the Vidispine API to retrieve an item id.
Notice that we're using two Postman variables for a specific environment:
{{vs}}: this is the Vidispine base address (url + port)
{{credentials}}: this is the username and password in basic http format (:) encoded in base64.
Ok, that was the principle of how to query the Vidispine API for an item id. Now let's do the same thing from code.
Given the following constants:
C#
private const string address = http://xxx.xxx.xxx.xxx:8080/API; private const string userName = admin; private const string password = admin;
1
2
3
private const string address = http://xxx.xxx.xxx.xxx:8080/API;
private const string userName = admin;
private const string password = admin;
Option 1: Using WebRequest class
C#
private static string GetUsingWebRequest(string requestUri) { var request = (HttpWebRequest)WebRequest.Create(requestUri); request.Credentials = new NetworkCredential(userName, password); using(var response = (HttpWebResponse)request.GetResponse()) { var stream = response.GetResponseStream(); var reader = new StreamReader(stream); string result = reader.ReadToEnd(); return result; } }
1
2
3
4
5
6
7
8
9
10
11
12
13
14
private static string GetUsingWebRequest(string requestUri)
{
var request = (HttpWebRequest)WebRequest.Create(requestUri);
request.Credentials = new NetworkCredential(userName, password);
using(var response = (HttpWebResponse)request.GetResponse())
{
var stream = response.GetResponseStream();
var reader = new StreamReader(stream);
string result = reader.ReadToEnd();
return result;
}
}
Create a WebRequest, set the credentials and execute the request. Remember to release the request calling the Dispose() method or wrapping the instance into a using statement as we did in the sample.
Notice that in this case, we know the response contains a plain text with an item id. That's why we read the stream, and converts it into a string instead of a specific type.
Option 2: Using HttpClient class
C#
private static string GetUsingHttpClient(string requestUri) { var handler = new HttpClientHandler() { Credentials = new NetworkCredential(userName, password) }; var client = new HttpClient(handler); client.BaseAddress = new Uri(address); string message = client.GetStringAsync(requestUri).Result; return message; }
1
2
3
4
5
6
7
8
9
10
11
12
13
private static string GetUsingHttpClient(string requestUri)
{
var handler = new HttpClientHandler()
{
Credentials = new NetworkCredential(userName, password)
};
var client = new HttpClient(handler);
client.BaseAddress = new Uri(address);
string message = client.GetStringAsync(requestUri).Result;
return message;
}
Similar to previous option, it is just a matter of using another http client from the .NET framework.
In this case, credentials are specified on a client handler, then the http client is created using that handler.
The request is executed asynchronously, which is powerful and could be needed in a real situation.
In this case we're just reading the Result property immediately, but it's important to understand that the request is fired in an independent thread. Once thread is completed, you can execute your own callback.
Option 3: Using Vidispine .NET SDK
C#
private static string GetUsingVidispineSdk() { var rootResource = new VidispineResource(address).Authenticate(userName, password); var itemResource = rootResource.Item; string result = itemResource.SearchPlainGET.Number(1).CallText(); return result; }
1
2
3
4
5
6
7
8
private static string GetUsingVidispineSdk()
{
var rootResource = new VidispineResource(address).Authenticate(userName, password);
var itemResource = rootResource.Item;
string result = itemResource.SearchPlainGET.Number(1).CallText();
return result;
}
Finally the easiest way to do it, just call the SDK. Notice that in this case, the action to be executed is not part of the address. You specify the object and action based on the properties. We may say this is the strongly typed option to do it.
You can find more information about how to download and use the Vidispine .NET SDK in the post Getting Started With the Vidispine .NET SDK. If you want to try out the SDK, you can find the latest versions of the SDK here:
64-bit version of the Vidispine .NET SDK v4.5
32-bit version of the Vidispine .NET SDK v4.5
Running the app will show you the result 3 times, once for each option. In this case first item available is #525 but of course that will depend on your environment.
You can download the full console app code from the following GitHub Gist.
Hope you like it.
This blog post was written by our friends at Binagora. Check them out and see how they can help you with your next Media&Entertainment project.
Most recent headlines
05/01/2027
Worlds first 802.15.4ab-UWB chip verified by Calterah and Rohde & Schwarz to be ...
04/08/2026
Dalet, a leading technology and service provider for media-rich organizations, t...
04/07/2026
April 7 2026, 19:00 (PDT) Detective Conan: Fallen Angel of the Highway Opens in...
01/06/2026
January 6 2026, 05:30 (PST) Dolby Sets the New Standard for Premium Entertainment at CES 2026
Throughout the week, Dolby brings to life the latest innovatio...
02/05/2026
Dalet, a leading technology and service provider for media-rich organizations, t...
01/05/2026
January 5 2026, 18:30 (PST) NBCUniversal's Peacock to Be First Streamer to ...
25/04/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
24/04/2026
Churchill Downs Inc. (CDI) has announced a definitive agreement to acquire the intellectual property of the Preakness Stakes and Black-Eyed Susan Stakes from 1/...
24/04/2026
Daktronics has partnered with DCL (Design Communications, Ltd.) to design, manuf...
24/04/2026
Chyron has announced PRIME Translate, a workflow solution that produces live content simultaneously in multiple languages within the PRIME platform. The system ...
24/04/2026
Eutelsat has announced a new partnership with Co-op Cable, introducing an expand...
24/04/2026
Pitch Dublin, an indoor golf simulation and hospitality venue on Dawson Street i...
24/04/2026
G&D and VuWall have announced two senior leadership appointments, effective Apri...
24/04/2026
Victory , the free sports streaming service from A Parent Media Co. Inc. (APMC), has announced a multi-year agreement to become the exclusive local streaming ho...
24/04/2026
The former business major from Massachusetts has found his home in graphics and bug operation while contributing to live ESPN productions
In the live-sports-vi...
24/04/2026
The Mid-Atlantic Sports Network (MASN) and Spectrum have announced a multiyear carriage agreement making MASN available to Spectrum customers in areas of southe...
24/04/2026
The NFL Draft is rebuilt from the ground up in a new city every year. The three-day fan festival is expected to draw 500,000 or more attendees, with millions fo...
24/04/2026
Diversified has continued expansion of its sports and media capabilities to supp...
24/04/2026
NAB reports that the 2026 NAB Show wrapped with more than 58,000 registered atte...
24/04/2026
Clear-Com has announced significant updates to its Arcadia Central Station and E...
24/04/2026
NAB reports that the 2026 NAB Show wrapped with more than 58,000 registered atte...
24/04/2026
Ratings Roundup is a rundown of recent rating news and is derived from press rel...
24/04/2026
B/R NFL Draft Live' refines the digital giant's productions around footb...
24/04/2026
Study highlights five pillars shaping modern fan engagement as broadcasters reth...
24/04/2026
The 2026 event, the first Draft with NFL Network under the ESPN umbrella, will b...
24/04/2026
In-venue and creative video staffers at the professional and collegiate level ha...
24/04/2026
Integral to the Draft production for three almost decades, the company tells the...
24/04/2026
Championing documentaries that illuminate and expand the artform is at the core ...
24/04/2026
The Peabody Awards spotlight excellent work that endures. This year's winner...
24/04/2026
Earth Day is a chance to reflect on our connection to the natural world. To mark the 57th Earth Day on April 22, Spotify's editors have pulled together a co...
24/04/2026
This past weekend, Spotify was at the heart of the largest literary event in the...
24/04/2026
All data tells a story, and in our case, that story is written by you. To celebrate 20 years of Spotify, we're sharing bite sized moments that capture how t...
24/04/2026
Over the past 20 years, Spotify's look and feel has evolved with the way people use our platform, while ensuring we preserve an intuitive, personal, and fam...
24/04/2026
It's been 20 years since Spotify began, but the real story is what the world chose to play. For the first time, we're unveiling the most streamed artist...
24/04/2026
Whether you're relaxing at home or on the go, Spotify is there across more than 2,000 devices, ready with your favorites or something new to discover. Now, ...
24/04/2026
Nintendo and Spotify are welcoming fans to the Super Mario Bros. 40th anniversary and the release of The Super Mario Galaxy Movie with new playlists and a speci...
24/04/2026
30 October - 1 November 2026
The Audio Engineering Society (AES) have announced that the AES Show 2026 will be held on Halloween weekend - Friday 30 October...
24/04/2026
New closed-back design promises honest' low end
Sennheiser have just announced the launch of a new pair of flagship closed-back headphones which they s...
24/04/2026
Powerful 12-channel hardware sequencer announced
Cre8audio are renowned for their innovative, and often visually striking designs, and although their latest...
24/04/2026
Room correction now supports full 9.1.6 Dolby Atmos setups
The software element of IK Multimedia's room-correction system has just received an update th...
24/04/2026
New content for BBO Tutti & BBO Riffs
VSL have recently introduced some new free content expansions for two of their most popular Big Bang Orchestra Packs: ...
24/04/2026
Rohde & Schwarz to highlight its R&S EVSD1000 UAV-based navigation analyzer at I...
24/04/2026
The National Film and Video Foundation (NFVF) is pleased to announce that the ca...
24/04/2026
ITV's Director of Drama Polly Hill has commissioned six part propulsive, lun...
24/04/2026
The NASA 777 aircraft departs the L3Harris facility in Waco, Texas....
24/04/2026
WASHINGTON, April 23, 2026 - L3Harris Technologies (NYSE: LHX) has closed a $1 b...
24/04/2026
In partnership with Airbus U.S. Space & Defense, Inc., L3Harris Technologies is advancing autonomous aviation for the U.S. Marine Corps' Aerial Logistics Co...
24/04/2026
L3Harris' hC2 software, powered by Systematic SitaWare, strengthens battlefield decision-making by using open architectures to connect platforms, sensors an...
24/04/2026
Artist rendering of L3Harris' AERIS X next-generation airborne early warning...
24/04/2026
AgileTV presents in Las Vegas its technological proposition to power safer, more scalable and efficient TV ecosystems for telecom operators, ISPs and entertainm...