
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 ...
31/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
31/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
31/10/2026
Riedel Communications today announced that live event production company FOH Productions has built a portable camera switching and control flypack that uses Rie...
30/10/2026
A highlight clip goes to air after a person says yes. What would it take to say how often that yes had to be earned?
Andreas EhstandA common design for automat...
30/10/2026
SNF's Chiefs-Seahawks leads the week with 26.3 million, Prime Video's Pa...
30/10/2026
The company aims to be more horizontal and not vertical' in managing sports rights and producing events
GRUP MEDIAPRO has begun charting a new course that...
30/10/2026
Player mics, an in-arena drone, enhanced replay operations, and a full onsite pr...
30/10/2026
By Ramona Flume
Each harvest season brings a sense of renewal and possibility. ...
30/10/2026
(L-R) Peter Dinklage, Alexander Skarsg rd, and Olivia Colman attend the Q&A for Wicker by Eleanor Wilson and Alex Huston Fischer, an official selection of the...
30/10/2026
Creates melodies from wavetables
BangZilla is the new plug-in division of The Audio Programmer, and their debut offering comes in the form of Wave Theory, a...
30/10/2026
30 October - 1 November 2026
This years AES Show is just around the corner, with this year's event marking the annual convention's first appearance ...
30/10/2026
Company launch new digitally controlled analogue hardware
Neve have just entered the world of digitally controlled analogue in style with not one, but four ...
30/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
30/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
30/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
30/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
30/10/2026
GB Labs Wins Future's Best of Show Award for Core.ONE, Presented by TVBEurope at IBC 2026
GB Labs, a leader in scalable, shared storage solutions, has rec...
30/10/2026
Lightware is introducing GPIO Button control for its Microsoft Teams Rooms on Windows (MTRoW) integration, giving users a simple, one-touch way to switch betwee...
30/10/2026
Lightware has added AVIXA Renewal Units (RUs) to its D sseldorf in-person training program, allowing AV professionals to earn recognized professional developmen...
30/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
30/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
30/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
30/10/2026
Creative software developer Foundry today announced Nuke Stage now supports macOS, making the end-to-end virtual production and in-camera visual effects (ICVFX)...
30/10/2026
While science fiction lore tells us that humans will meet extraterrestrial life ...
29/10/2026
Jameis Winston and Willie Colon are among current and former players hosting pro...
29/10/2026
After arriving in Fayetteville with dreams of calling games, the Arkansas native found her passion in the control room, building a promising future in replay an...
29/10/2026
The National Hockey League is taking on a larger role in local game production w...
29/10/2026
Media Links has appointed Mikhail Zavalin Market Development Technical Specialis...
29/10/2026
Gravity Media delivered the live broadcast and media infrastructure for the 2026...
29/10/2026
Rise AV has announced the 23 women selected for the second year of its Elevate program, a six-week management and leadership development course. The cohort incl...
29/10/2026
The F d ration Internationale de l'Automobile (FIA) and Amazon Web Services (AWS) have announced a global partnership under which AWS becomes the Official A...
29/10/2026
Advanced Systems Group (ASG) has appointed Bob Daniel Storage and Workflow Solutions Architect within its Enterprise Storage team. Daniel has more than 30 years...
29/10/2026
FloSports and the Pac-12 Conference have entered a media partnership that will b...
29/10/2026
TSN will launch Film Never Lies Grey Cup Playoffs Watchalong, an altcast hosted by TSN football analyst Luke Willson, for two CFL Grey Cup Playoffs games. Wills...
29/10/2026
For decades, broadcasters have designed production around one rule: build for th...
29/10/2026
Live event production company FOH Productions has built a portable camera switch...
29/10/2026
Gravity Media is marking its 25th year facilitating the host broadcast for the M...
29/10/2026
In-venue and creative video staffers at the professional and collegiate level ha...
29/10/2026
LA28 has named film producer Kathleen Kennedy Head of Ceremonies and Content for the LA28 Olympic and Paralympic Games. Kennedy, an eight-time Academy Award nom...
29/10/2026
In-house local telecasts have added new camera angles, graphics package, and dee...
29/10/2026
In this SVG New Sponsor Spotlight, Jake Blount, EVP, Sales, ICAT Logistics, disc...
29/10/2026
Mastering plug-in treated to ground-up rebuild
With a few plug-in releases now under their belt, Musik Hack have revisited their debut offering and kitted i...
29/10/2026
New modular full-range monitoring system arrives
Following a few weeks of teasers, HEDD Audio have just revealed the latest addition to their high-end monit...
29/10/2026
SGL Carbon LLC ( SGL Carbon ) has received an additional order for the supply of nuclear graphite from X-energy Reactor Company, LLC ( X-energy ) in accordance ...
29/10/2026
Rohde & Schwarz introduces MXO AI Connect for AI-assisted oscilloscope workflows Rohde & Schwarz connects AI assistants to its MXO oscilloscopes through MXO A...
29/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
29/10/2026
Share
Copy link
Facebook
X
Linkedin
Bluesky
Email...
29/10/2026
When LinkedIn set out to upgrade meeting spaces across nine APAC cities, the goal was clear: employees needed to walk into rooms in Bangalore, Beijing, Hong Kon...
29/10/2026
Lightware has expanded its LARA (Lightware Advanced Room Automation) Wizard platform with a new Elgato Stream Deck integration, allowing supported Stream Deck d...