
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
06/10/2025
France T l visions, France's leading broadcaster, has received the 2025 EBU ...
04/09/2025
Monumental Sports & Entertainment (MSE), in collaboration with Dalet, has been a...
07/08/2025
July 8 2025, 22:30 (PDT) Tata Motors & Dolby Bring Dolby Atmos to Harrier.ev, R...
18/07/2025
Blanche Barton, Peter Gilmore, Scott Cummings, Sundance Institute Director of Programming Kim Yutani, and Peggy Nadramia throwing horns. (Stephen Lovekin/Shutte...
18/07/2025
By Jessica Herndon
One of the most exciting things about the Sundance Film Fest...
18/07/2025
BOSTON Sports network NESN today relaunched the NESN 360 app with a redesigned user experience and upgrades....
18/07/2025
Berklee Singers Wow the Competition on Netflixs Building the Band Netflixs new music competition show features two Berklee artists looking to make their pop b...
18/07/2025
As the House of Representatives voted early Friday morning to eliminate federal funding for public broadcasting, advocates warned that the elimination of $1 bil...
18/07/2025
DENVER Imagine Communications has announced that it is deepening its commitment to the North American sports and live events market with investments in its prod...
18/07/2025
LOS GATOS, Calif. Netflix once again reported strong financial growth, with revenue increasing 16% year-over-year to $11.079 billion in Q2 2025 as net income s...
18/07/2025
Live from the 153rd Open Championship: SMT Enhances Video Board Experience; Enab...
18/07/2025
ShotTracker's Davyeon Ross on Revolutionizing Basketball On the Court and ...
18/07/2025
Home Pitch: How the Danish League Brought Its Live Match Production In-House Matchday Production produced 800+ matches across Denmark in its first year By Geor...
18/07/2025
Live From the 153rd Open Championship: EMG Debuts Spidercam for Golf, Expands Su...
18/07/2025
Usyk vs Dubois II: Bringing the fight to life with state of the art cameras and ...
18/07/2025
Usyk vs Dubois II: DAZN's head of boxing Chris Glanville talks helicopters, ...
18/07/2025
Live From the 153rd Open Championship: NBC Expands Unilateral Effort; Shared Stu...
18/07/2025
Warner Bros. Discovery's Anne Graham on Training New Professionals to Ensure...
18/07/2025
Live From the 153rd Open Championship: How R&A Spidercam Became a Reality for Go...
18/07/2025
ESPN Bulks Up Onsite Studios, Cameras, Player Mics for WNBA All-Star Weekend Besides the game, four studio shows will be produced onsite By Jason Dachman, Edit...
18/07/2025
Friday 18 July 2025
Credit: Marc Sethi
The Sky Arts Awards will return on 16 September, once again taking place at the iconic Roundhouse in London. Produced b...
18/07/2025
This month, players can dive into special crossover events featuring SpongeBob SquarePants in Snake.io+ and Crossy Road Castle, available exclusively on Apple A...
18/07/2025
Up for the Match brings the fun, the passion-and a bit of Riverdance- tomorrow n...
17/07/2025
Blanche Barton, Peter Gilmore, Scott Cummings, Sundance Institute Director of Programming Kim Yutani, and Peggy Nadramia throwing horns. (Stephen Lovekin/Shutte...
17/07/2025
Spotify's goal with audiobooks is to help grow the publishing industry and create the best possible experience for booklovers, which is why we're launch...
17/07/2025
An advanced large solid rocket motor hot fire test conducted at L3Harris' Camden, Arkansas, site....
17/07/2025
L3Harris payloads and components have been on board every U.S. GPS satellite-more than 70 missions since the 1970s. Our technology is at the core of GPS availab...
17/07/2025
L3Harris' pack of launched effects is comprised of multi-role vehicles that ...
17/07/2025
NEW YORK - July 17, 2025 - Gracenote, the content data business unit of Nielsen, has announced the appointment of Ryan Moore to the new role of Chief Business O...
17/07/2025
READING, Pa. Network technology startup Miri Technologies has added David Cohen as vice president, business development. He'll be tasked with expanding the ...
17/07/2025
Berklee Wins CASE Award for Standout Digital Campaign The Alumni Affairs team's Variations Signature Series earned recognition for offering an authentic p...
17/07/2025
Early Thursday morning, the U.S. Senate voted to cut federal funding for PBS and NPR in a bill that also included cuts for foreign aid. In a 51-48 vote, the act...
17/07/2025
GREAT Britain and Northern Ireland Pavilions across IBC2025 (12 15 September, RAI Amsterdam) feature a remarkable 34 companies, each providing unique, innovativ...
17/07/2025
WHITE PLAINS, N.Y. The Society of Motion Picture and Television Engineers today introduced its Content Provenance and Authenticity (CPA) in Media Study Group (S...
17/07/2025
NEW YORK Despite widespread concerns about a soft advertising market, NBCUniversal said it closed its 2025-26 upfront negotiation cycle with a record ad sales v...
17/07/2025
NEW YORK Television advertising remains an effective means to market and influence younger baby boomer and Generation X consumers approaching retirement age, ac...
17/07/2025
ALLENTOWN, Pa. & JERSEY CITY, N.J. Service Electric Cable TV and OpenVault have announced that the operator is deploying the OpenVault Proactive Network Manage...
17/07/2025
WASHINGTON Following up on his first major policy speech just two ago, Federal Communications Commission Chair Brendan Carr is promising to buck the usual summ...
17/07/2025
Luxembourg, 14 July 2025 - SES received the final regulatory approvals for the SES-Intelsat transaction, including the US Federal Communications Commission.
O...
17/07/2025
Berklee Alumni Nominated for 2025 Emmy Awards Twenty-seven Berklee alumni received nominations across categories in sound mixing, sound editing, and compositi...
17/07/2025
Back to All News
What We Watched the First Half of 2025
Entertainment
17 July 2025
Global
Link copied to clipboard
Today, we're sharing our latest Eng...
17/07/2025
Cast your vote in 2 categories for Ivory 3 American Concert DIvory 3 American Concert D is in the 2025 MIDI Innovation Awards and we are honored to be nominated...
17/07/2025
SVG Sit-Down: OpenDrives' Sean Lee, Michael Wilsker, and Jason Matousek on E...
17/07/2025
Oracle's Geoff Tognetti on Staying Ahead of the AI Curve Through Further Ado...
17/07/2025
NBA's Summer League Is a Hot Bed of AI, Immersive Innovation Testing Audio mixing, intelligent camera framing are among AI-driven efforts By Ken Kerschbaum...
17/07/2025
SVG's TranSPORT Conference Returns to NYC on Oct. 21; Register Today! By SVG Staff
Thursday, July 17, 2025 - 8:29 am
Print This Story | Subscribe
St...
17/07/2025
Gravity Media chosen as group name for merged OB business By George Bevir
Wednesday, July 16, 2025 - 11:30
Print This Story
Gravity Media executive chairm...
17/07/2025
SES Closes Deal to Acquire Intelsat, Creating New Giant in Satellite Connectivit...
17/07/2025
How MLB Pulled Off That Unforgettable Hank Aaron Tribute at the All-Star Game Vintage content, state-of-the-art projection/processing combine in marvelous mile...
17/07/2025
Wuppertal July 17, 2025
Riedel Communications Powers Handa Opera on Sydney Har...