
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
09/11/2025
Dalet today announced a transformative leap forward for media operations: Agentic Artificial Intelligence (AI) that unifies the Dalet ecosystem under one natura...
17/10/2025
HBO Max is reporting that it has launched in 15 new markets, including Bangladesh, Cambodia, Macau, Pakistan, Sri Lanka and Ukraine, boosting the streaming serv...
17/10/2025
Netflix said it will make a major push into video podcasts, inking a wide-ranging deal with Spotify through which it will offer 16 podcasts in the U.S. starting...
17/10/2025
Lexington, Ky. As part of a push to highlight its advanced advertising capabilities, Viamedia has launched a new AI-powered ad tech platform and officially rebr...
17/10/2025
NEW YORK QuickLink has announced the release of StudioPro Version 4, which the company is calling the most significant upgrade yet to its flagship video product...
17/10/2025
NEW YORK and CUPERTINO, Calif. Apple and NBCUniversal said they will sell Apple TV and Peacock streaming bundles to U.S. subscribers starting Oct. 20....
17/10/2025
Q&A with Boston Conservatory Choral Conductor Stephen Spinelli How his research into the lost manuscripts of composer Florence Price led to a Grammy-winning c...
16/10/2025
SVG Sit-Down: FUJIFILM Execs on GFX ETERNA 55 Camera, Importance of Shallow-Dept...
16/10/2025
Squash's Most Ambitious Broadcast Production To Be Deployed at Comcast Busin...
16/10/2025
Main Street Sports Group Inks Deal With Omaha Productions, Launches Original-Con...
16/10/2025
A Historic Precursor? FIFA, HBS, DAZN Offer an Inside Look at Production of FIFA...
16/10/2025
Prime Video Offers Sneak Peak at New NBA on Prime StudioThe massive 13,000-sq-ft, two-story studio features a LED regulation half court and hoopBy Jason Dachman...
16/10/2025
SVG Remote Production Forum Draws Record Crowd for Visit to PGA TOUR Studios, De...
16/10/2025
BitFire's Ben Grafchik on How Growing Cloud Workflows Are Impacting the Live...
16/10/2025
AI technology is advancing quickly, bringing both new creative possibilities and...
16/10/2025
In 2017, Imani Ellis launched CultureCon, a conference that's become a must-attend event for more than 10,000 diverse creatives and Black professionals to c...
16/10/2025
It might still be a little early to break out the tinsel and mistletoe, but Spotify's already queuing up some holiday magic. This year's Spotify Singles...
16/10/2025
Earlier this year, our in-house publishing imprint, Spotify Audiobooks, put out ...
16/10/2025
VAMPIRE has been integrated onto GM Defenses Infantry Squad Vehicle (ISV), providing a mobile solution to effectively and affordably counter small drone threat...
16/10/2025
The AgilePod mounted on the host aircraft....
16/10/2025
60% say infotainment systems are a critical purchasing or leasing consideration,...
16/10/2025
NEW YORK The Broadcasters Foundation of America has launched its 2025 Year-End Giving Campaign, which seeks to raise donations from tax-deductible personal and ...
16/10/2025
Roku has added several new features to its user interface and operating system meant to make it easier to discover and personalize content, the company said....
16/10/2025
NEW YORK CNN has announced that its All Access subscription tier will launch in the U.S. on Oct. 28, providing audiences with a centralized destination for CNN&...
16/10/2025
Student Spotlight: Alan Villanueva The graduate student and saxophonist, who performed on Natalia Lafourcades Latin Grammy-nominated Live at Carnegie Hall alb...
16/10/2025
The XR Sports Alliance (XRSA) has announced the third cohort of members. The new members include Maple Leafs Sports & Entertainment (MLSE), the Vegas Golden Kni...
16/10/2025
NEW YORK The Broadcasters Foundation of America has launched its 2025 Year-End Giving Campaign which seeks to raise donations from tax-deductible personal and c...
16/10/2025
NEW YORK Australia's Nine Network and the NHL today announced a media partnership that will bring the world's premier professional ice hockey league to ...
16/10/2025
Parks Associates has released new data showing that nearly half (45%) of U.S. internet homes watch free ad-supported streaming TV (FAST) services and 89% of U.S...
16/10/2025
TROY, Mich. -New data from J.D. Power's 2025 U.S. Residential Internet Service Provider Study shows that residential wireless internet providers are growing...
16/10/2025
TV's most charming detective drama * Shakespeare & Hathaway: Private Investi...
16/10/2025
Back to All News
Thailand's Legendary Outlaw Returns: Tee Yai: Born to be ...
16/10/2025
Back to All News
Christmas Is Just Around The Corner: Home For Christmas Season...
16/10/2025
Back to All News
Trist n Ulloa Stars in El crimen de Pazos, the New Netflix Ser...
16/10/2025
ABS Completes Redomiciliation to Dubai Development Authority as Part of Strategi...
16/10/2025
This Saturday October 18 Katja Mia will burst onto the radio airwaves for the first time as she joins 2FM. Katja will be standing in for Bl thnaid Treacy on Sat...
16/10/2025
This October, RT is delighted to support Wexford Festival Opera, Babor International Arts Festival for Children, Open House Dublin and 36 other arts and cultu...
16/10/2025
GeForce NOW is more than just a platform to stream fresh games every week - it offers celebrations for the gamers who make it epic, with member rewards to sweet...
15/10/2025
Across the world, early-career reporters are interrogating systems that shape daily life, from mortuaries and classrooms to the corridors of legal education and...
15/10/2025
St. Louis Blues Pay Tribute to Ozzy Osbourne in New Pregame Open VideoThe NHL franchise worked with production firms 2WEI and 4th Floor CreativeBy Mark J Burns,...
15/10/2025
Cobalt Digital, G3DVu, Proxima Vision, and Telos Alliance Renew Premier Sponsors...
15/10/2025
By Paige Bethmann
Before my grandmother passed away in 2019, I went to visit her in the hospital where she'd been for a few weeks. When I arrived, the nurs...
15/10/2025
Two years ago, Spotify set out to grow the entire publishing industry by making ...
15/10/2025
People turn to DJ for a listening experience that feels personal, dynamic, and j...
15/10/2025
Las personas recurren a DJ para vivir una experiencia de escucha personal, din m...
15/10/2025
Rock legend Bruce Springsteen and luminary actor Jeremy Allen White came togethe...
15/10/2025
At Spotify, we're all about supporting rising talent and helping them connec...
15/10/2025
New SBS Documentary Series THE CANCER KILLERS Premieres 4 November on SBS & SBS ...
15/10/2025
SBS celebrates the Festivals of Lights with bold, illuminating stories across th...