
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...
26/06/2025
Louis Greatorex, Amrou Al-Kadhi and Bilal Hasana. (Stephen Lovekin/Shutterstock for Sundance Film Festival)
By Veronika Lee Claghorn
The world premiere of Amr...
26/06/2025
Buckle up for Great Australian Road Trips launching 31 July on SBS and SBS On De...
26/06/2025
Think of any major merger or acquisition in the media tech industry over the last 15 years and the odds are pretty good that MediaBridge Capital Advisors will h...
26/06/2025
Scott Gershin is an award-winning sound supervisor, sound designer, and mixer who has been a pioneer and leader in the film and gaming community for over three ...
26/06/2025
Bilbao Linz, June 26th 2025 - AgileTV, a European leader in TV and video technology solutions, has signed an agreement this week with the Austrian telco LIWES...
26/06/2025
aconnic AG (ISIN: DE000A0LBKW6), Munich, has resolved, based on the decisions ma...
26/06/2025
LAS VEGAS Sphere Entertainment Co. has released new details around the sound, score and infrasound haptic seats for The Wizard of Oz at Sphere, a fully immersiv...
26/06/2025
Three new entry-level models introduced
Catering to everything from casual listening to professional content creation, KRK's new Kreate Series monitors ...
26/06/2025
Berklee in Puerto Rico 30th Anniversary Celebration Culminates in Awarding $3.74...
26/06/2025
PITTSBURGH NEP Group has launched Supershooter 10, its' latest IP-powered mobile production unit, which is now supporting major broadcast production around ...
26/06/2025
SAN JOSE, Calif. The HDMI Forum has released Version 2.2. of the HDMI Specification with 96Gbps bandwidth and next-gen HDMI Fixed Rate Link technology to provid...
26/06/2025
LAS VEGAS Sphere Entertainment Co. has released new details around the sound, score and infrasound haptic seats for The Wizard of Oz at Sphere, a fully immersiv...
26/06/2025
Registration closes on 8 July 2025
The deadline for entires into the fifth annual MIDI Innovation Awards is now just two weeks away. Product submissions are...
26/06/2025
Entire plug-in range updated
Waves have announced the launch of Waves V16, the latest version of their extensive plug-ins collection. Along with compatibili...
26/06/2025
UKTV and Talented People are delighted to announce the renewal of their successf...
26/06/2025
THE EXTRAORDINARY GENERAL MEETING OF MAGYAR TELEKOM DECIDES ON THE SEPARATION OF...
26/06/2025
10th-Annual SVG Regional Sports Production Summit Presents Useful Roadmap for th...
26/06/2025
The Big Cloud Debate: Public vs. Private vs. Hybrid Tech leaders from CineSys, Diversified, and Net Insight breaks down all flavors of cloud By Jason Dachman, ...
26/06/2025
Program Productions' Jess Kowatch on Training the Next and Current Gener...
26/06/2025
Investment in 32 LDX 135 camera systems enhances TV SKYLINE's fleet with nat...
26/06/2025
Keeper Pictures, the Dublin-based scripted production company whose credits include The Gone and Striking Out, has optioned the exclusive TV adaptation rights t...
26/06/2025
This July, RT presents The Phone Box Babies, a documentary revealing new insigh...
26/06/2025
Editor's note: This blog is a part of Into the Omniverse, a series focused o...
26/06/2025
Mark Theriault founded the startup FITY envisioning a line of clever cooling products: cold drink holders that come with freezable pucks to keep beverages cold ...
26/06/2025
This GFN Thursday rolls out a new reward and games for GeForce NOW members. Whether hunting for hot new releases or rediscovering timeless classics, members can...
25/06/2025
Aubrey Plaza getting ready for My Old Ass (photo by George Pimentel/Shutterstock...
25/06/2025
On the set of Leslie McCleave's The Shamrocks with Mount Timpanogos as a backdrop during the 1999 Directors Lab. Photo by Sandria Miller...
25/06/2025
Last week, content creators from all over the world flocked to Anaheim for VidCon 2025, one of the largest creator conferences in the U.S. As an official sponso...
25/06/2025
The combination of L3Harris Falcon radios and Project 25 Trunking waveform delivers a critical interoperable communications capability for the U.S. National Gu...
25/06/2025
eds3_5_jq(document).ready(function($) { $(#eds_sliderM519).chameleonSlider_2_1({ content_source:......
25/06/2025
YouTube Extends Lead and Tops All Media Distributors for Fourth Consecutive Mont...
25/06/2025
Copenhagen, Denmark - 25 June, 2025 - Nielsen, a global leader in audience measu...
25/06/2025
LONDON The IBC Show on Tuesday unveiled plans for its 2025 event, scheduled for Sept. 12-15 at the RAI Amsterdam....
25/06/2025
Covert Brings Boss' VFX To New Lenovo Legion Campaign
Brie Clayton June 25, 2025
0 Comments
Creative studio Covert recently contributed VFX to A...
25/06/2025
Study Reveals Stark Gender Gap in Jazz Education A new report from the Berklee Institute of Jazz and Gender Justice and researcher Lara Pellegrinelli finds th...
25/06/2025
Olivia Trusty was officially sworn in to the Federal Communications Commission by Chair Brendan Carr on Monday....
25/06/2025
KRK introduces the Kreate Series Studio Monitors, the newest addition to the brand's wide range of audio offerings. The Kreate monitors bring extraordinary ...
25/06/2025
Collaboration with space-branded real estate specialist brings next level offshoring agility to broadcasters, OTT platforms, media tech and software companies ...
25/06/2025
Sales proceeds from 25 - 26 June 2025 donated to Lambda Legal
Soundtoys have announced that 100% of all sales made on 25 and 26 June 2025 will be donated to...
25/06/2025
No Apollo or UAD hardware required
Universal Audio have announced that their software recreation of Dolby's renowned multiband enhancer - which was laun...
25/06/2025
Recreates AKGs sought-after C24
Warm Audio have announced the launch of a new stereo valve microphone that offers a modern take on AKG's sought-after C2...
25/06/2025
TBS Drama Series Extremely Inappropriate! Uses DaVinci Resolve Studio
Brie Clayton June 25, 2025
0 Comments
Tokyo Broadcasting System's hit comedy...
25/06/2025
ESPN said ABC's telecast of the Oklahoma City Thunder's victory over the Indiana Pacers in Game 7 of the NBA Finals on June 22 was the most-watched fina...
25/06/2025
CLAREMONT, N.C. CommScope has unveiled its new FiberREACH product and has launched the CableGuide 360 platform. Both fall within CommScope's SYSTIMAX 2.0 po...
25/06/2025
LOS ANGELES Allen Media Group streaming platform Local Now today launched 23 news, sports and entertainment channels from Warner Bros. Discovery....
25/06/2025
LONDON Electric Sheep has launched a new AI-powered platform that is designed to provide creators with the hands-on ability to iterate, edit and produce pro-lev...