
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...
08/07/2025
WASHINGTON Federal Communications Commission Chair Brendan Carr is applauding the passage of President Donald Trump's One Big Beautiful Bill and provision...
08/07/2025
SYDNEY RTS has announced that Channel 7 Sydney has deployed a new comms system from RTS as part of a larger ST-2110 upgrade....
08/07/2025
ATLANTA & CINCINNATI Gray Media, Inc. and The E.W. Scripps Company have entered into agreements to swap television stations across five mid-sized and small mark...
07/07/2025
SBS Farewells Chair George Savvides AM
7 July, 2025
Media releases
Born of Greek Cypriot parents, Mr Savvides joined the SBS Board as Deputy Chair in Febru...
07/07/2025
Advanced vision solutions deliver more than reliable night vision for tactical-edge warfighters. Today's technological advances can provide the capability f...
07/07/2025
BALTIMORE Sinclair has named Narinder Sahai its executive vice president and chief financial officer, effective immediately....
07/07/2025
Riedel Communications today announced the launch of RefSuite, a powerful new Managed Technology solution tailored to professional sports workflows. RefSuite com...
07/07/2025
Regional base will foster client engagement, partner collaboration, and executive touchpoints
Skandha Media Services, a leading provider of cloud-native media ...
07/07/2025
Advanced Systems Group, LLC (ASG), a technology and services provider for media creatives and content owners, announced its Against All Odds - ASG Builds Cutti...
07/07/2025
Agreement secured on the strength of Skandha's proven track record in delivering reliable managed services across the full content life cycle for existing h...
07/07/2025
1-2 Punch: The Cloud, Generative AI, and the Future of Sports-Content Distributi...
07/07/2025
Tests and decisions: Formula E host broadcaster Aurora on launching new AR graph...
07/07/2025
Building tension: Using new AR graphics for storytelling at the Formula E penult...
07/07/2025
Altitude Sports' Matt Krol on the Success of the RSN's In-Arena Postgame...
07/07/2025
SVG Rewind: Four NFL Clubs Bring Us on Set of Respective Media Day Shoots An in-depth conversation with 49ers Laura Johnson, Ravens Jay O'Brien, Las Vegas R...
07/07/2025
Cosm To Build Fifth Shared Reality Venue in Cleveland as Part of Bedrock's ...
07/07/2025
Back to All News
She Walks in Darkness, Agust n D az Yanes New Film, Premieres ...
07/07/2025
CULVER CITY, CALIFORNIA As Apple Music marks its 10th anniversary this year, Apple unveils its most ambitious creative project to date: a brand-new state-of-the...
07/07/2025
RT has announced that Mark Bignell has been appointed Commissioning Editor for Comedy following a public competition. This senior editorial position will drive...
05/07/2025
Back to All News
Superestar, the Story of a Star Who Never Changed. Premiering July 18
Entertainment
05 July 2025
GlobalSpain
Link copied to clipboard
Dis...
04/07/2025
By Lucy Spicer
Editor's note: We are deeply saddened by the passing of Robe...
04/07/2025
The Summer Reading Challenge has inspired children across the U.K. to embrace a ...
04/07/2025
Introducing CVP Auctions: Trusted Tech, At Auction-Only Prices
Brie Clayton July 4, 2025
0 Comments
A New Destination for Film and Broadcast Gear at U...
04/07/2025
Unveiling China's Ecological Wonders with URSA Mini Pro 12K
Brie Clayton July 4, 2025
0 Comments
Nature Documentaries Freeze Epic Momentsin Extrem...
04/07/2025
Create Any Planet in After Effects
Graham Quince July 4, 2025
0 Comments
The Advanced 3D renderer in After Effects makes it really easy to import 3D o...
04/07/2025
Custom Gradient Colorize for Resolve Fusion
Simon Ubsdell July 4, 2025
0 Comments
Digging into the theory of the gradient colorize process to build ou...
04/07/2025
Watching live sports on TV these days is a delicate balance for broadcasters how much information is too much?...
04/07/2025
WASHINGTON As Federal Communications Commission Chair Brendan Carr works to achieve his goal of a very busy, productive summer at the FCC, the agency has rele...
04/07/2025
Other World Computing Launches OWC Guardian USB-C Hardware-Encrypted Portable SS...
04/07/2025
CANAL Brings MotoGP to Vision Pro with Blackmagic URSA Cine Immersive
Brie Clayton July 3, 2025
0 Comments
Experience MotoGP like never before as CA...
04/07/2025
Friday 4 July 2025
Watch the trailer here https://youtu.be/Od5WpvWmDr8
Further...
04/07/2025
The Pitch comes to RT Radio 1 airwaves this Sunday at 7pm. The Pitch is a brand...
03/07/2025
For our Vario-Jib, as well as for a repertoire of weights, we now have carts that make transport easier...
03/07/2025
One of our latest innovations: Slider Drive Unit!
Our Vario Slider not only comes with improvements and new features, but also with its own drive unit!
Our i...
03/07/2025
The 360 EVO lives up to its name: 360-degree rotation not only on the pan axis, but also on the roll axis, enables filmmakers to take their creative visions eve...
03/07/2025
What a buzzing few days at BSCExpo in London!
We were thrilled to connect with so many talented professionals from the world of cinematography.
A huge thank ...
03/07/2025
ADOLESCENCE - Shot with Panther Tower"The whole rig had to be detachable mid-episode
Netflix limited drama series Adolescence has been gaining attentio...
03/07/2025
To achieve a true level of decisive overmatch, communication systems must be as ...
03/07/2025
The Broadcasters Foundation of America has named Ray Hopkins, president of U.S. distribution at Paramount Global, to its board of directors....
03/07/2025
SIOUX FALLS, S.D. In his first major policy speech, Federal Communications Commission chair Brendan Carr outlined his Build America Agenda for the agency'...
03/07/2025
As the industry is making a major push to transition to NextGen TV and develop new businesses that will fund the next generation of broadcasting, TV Tech's ...
03/07/2025
Despite enabling its subscribers to watch films and TV shows in the highest possible resolution, Netflix has revealed it is taking things old school with the in...
03/07/2025
WASHINGTON In response to news that Paramount Global has agreed to pay $16 million to settle a lawsuit by President Donald Trump, Democrats and other administra...
03/07/2025
WUPPERTAL, Germany Riedel Communications today launched RefSuite for professional sports workflows....
03/07/2025
WEITERSTADT, Germany LYNX Technik, a provider of modular signal processing solutions, has announced that founder and longtime CEO Winfried Deckelmann is steppin...
03/07/2025
WASHINGTON Representatives from six trade groups representing tech, pay TV, broadband, LPTV and other sectors recently met with Federal Communications Commissio...
03/07/2025
PLYMOUTH, Wis. Dan Whealy has acquired Heartland Video Systems and will be its new owner and president, the systems integrator said....
03/07/2025
Acclaimed filmmaker, educator, and industry veteran Jay Holben has released his most ambitious work to date: The Director's Guide to Everything a sweeping...