Sony Pixel Power calrec Sony

ree Simple Meods to Invoke the Vidispine API From .NET Code

15/06/2016

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.
LINK: http://howto.vidispine.com/insight/three-simple-methods-to-invoke-the-...
See more stories from vidispine

Most recent headlines

06/10/2025

France Tlvisions Wins Prestigious 2025 EBU Technology & Innovation Award in Groundbreaking Collaboration with Dalet

France T l visions, France's leading broadcaster, has received the 2025 EBU ...

04/09/2025

Monumental Sports & Entertainment and Dalet Win Prestigious 2025 NAB Show Project of the Year Award

Monumental Sports & Entertainment (MSE), in collaboration with Dalet, has been a...

07/08/2025

Tata Motors & Dolby Bring Dolby Atmos to Harrier.ev, Redefining In-Car Entertainment Experience

July 8 2025, 22:30 (PDT) Tata Motors & Dolby Bring Dolby Atmos to Harrier.ev, R...

29/07/2025

UEFA Womens EURO 2025 drives surge in ad-funded streaming as Yospace powers 6 billion one-to-one advertisements

Staines-upon-Thames, UK, 29 July, 2025 Yospace, the global leader in Dynamic Ad ...

29/07/2025

2025 Sundance Institute Trans Possibilities Intensive Announced

Six Fellows Selected for Program Supporting Projects From Transgender Storytellers of Color Today the nonprofit Sundance Institute announced the six artists p...

29/07/2025

Give Me the Backstory: Get to Know Michael Shanks, the Writer-Director of Together

By Jessica Herndon One of the most exciting things about the Sundance Film Fest...

29/07/2025

Spotify Reports Second Quarter 2025 Earnings

Today, we announced our second quarter 2025 earnings, fueled by standout subscriber and MAU growth. In the first half of 2025, subscriber net additions grew mor...

29/07/2025

Spotify rapporterar intkter fr andra kvartalet 2025

Idag rapporterar vi resultatet f r andra kvartalet 2025, med stark tillv xt av antalet prenumeranter och m natliga aktiva anv ndare. Under f rsta halv ret kade...

29/07/2025

Viewing to Content with Ads Gained Share to 73.6% of Overall TV Viewing in Q2, Nielsen's Q2 2025 Ad Supported Gauge Finds

Streaming Holds Steady in a Lighter Summer Viewership Season NEW YORK - July 29...

29/07/2025

Viewing of Ad-Supported Services Grew to 73.6% of TV Viewing in Q2

NEW YORK Nielsen is reporting that viewing of content with ads became more popular in Q2, 2025, gaining 1.2 share points of overall TV viewing to capture 73.6% ...

29/07/2025

QuickLink Launches New StudioEdge Products for IBC2025

SAN ANTONIO QuickLink has launched two new versions of its StudioEdge line of products: StudioEdge-1 and StudioEdge-2 provide one-channel and two-channels of br...

29/07/2025

SBE Honors Irwin, Bialik for Engineering Achievements

The Society of Broadcast Engineers has announced the recipients of the 2025 SBE National Awards, which recognize outstanding achievements by individual members,...

29/07/2025

Cobalt Digital to Feature Plug-and-Play ST 2110 Solutions at IBC 2025

CHAMPAIGN, Ill. Cobalt Digital is heading to IBC 2025 with an expanded lineup of IPMX-compliant products and solutions that highlight its simple plug-and-play a...

29/07/2025

G&D Outlines Plans for Live KVM and Video Processing Demos at IBC2025

AMSTERDAM German manufacturer Guntermann & Drunck GmbH (G&D) has announced that it will present a wide range of KVM and video processing solutions for broadcast...

29/07/2025

Guntermann and Drunck at IBC 2025 Live demos of innovativ...

At IBC 2025 in Amsterdam (September 12 15), German manufacturer Guntermann & Drunck GmbH (G&D) will present a range of intelligent solutions designed to meet th...

29/07/2025

Space42, Microsoft, and Esri Sign Memorandum of Understanding to Enhance Mapping Capabilities Across Africa

MoU will support the Map Africa Initiative, a program designed to create a con...

29/07/2025

X-Rite Launches CT2100 Spectrophotometer for Fast, Affordable Retail Paint Color Matching

X-Rite Launches CT2100 Spectrophotometer for Fast, Affordable Retail Paint Color...

29/07/2025

Adrian Edmondson and Lesley Sharp join cast for second series of Bergerac

Filming is now underway with Damien Molony and wider cast returning to Jersey for Bergerac, written by Toby Whithouse alongside Ashley Sanders, Emilie Robson an...

29/07/2025

NBA Summer League Tests Out, Refines Audio Workflows

NBA Summer League Tests Out, Refines Audio Workflows New mic arrays and ways of mixing them are a focus By Dan Daley, Audio Editor Tuesday, July 29, 2025 - 7...

29/07/2025

Athlete Audio Builds Fan Engagement, Player Branding at WNBA All-Star

Athlete Audio Builds Fan Engagement, Player Branding at WNBA All-Star Specialist A2 Ron Thompson has helped the technology evolve for decades By Dan Daley, Aud...

29/07/2025

Dante, Dell Technologies, Google, SMT, and Wave Central Renew Corporate Sponsorships

Dante, Dell Technologies, Google, SMT, and Wave Central Renew Corporate Sponsors...

29/07/2025

Ross Video Case Study: How to Draw Fans Deeper into the Game

Ross Video Case Study: How to Draw Fans Deeper into the Game By SVG Staff Tuesday, July 29, 2025 - 11:36 am Print This Story | Subscribe Story Highlight...

29/07/2025

FIFA Club World Cup 2025: Sounding Off With HBS at the Largest Production for a Club Competition Ever

FIFA Club World Cup 2025: Sounding off with HBS at the largest production for a ...

29/07/2025

'Breathless' Returns to Netflix, Premiering October 31st

Back to All News Breathless Returns to Netflix, Premiering October 31stPlay Video Play Video Entertainment 29 July 2025 GlobalSpain Link copied to clipboa...

29/07/2025

Made in New Jersey: Finding the Perfect Shot for Our Hit Sequel Happy Gilmore 2'

Back to All News Made in New Jersey: Finding the Perfect Shot for Our Hit Seque...

29/07/2025

FOR-A America Partners with TecNec for U.S. Distribution

Relationship Marks First U.S.-Based Distribution Partnership for FOR-A America...

29/07/2025

How Modesto Irrigation District Future-Proofed Its Public Communications with Broadcast Pix

A wide shot of MID's new Public Meeting Chambers in session, showcasing the ...

29/07/2025

Arqiva celebrates connecting 2.5 million Smart Water Meters to its network

Through reliable connectivity and industry-leading levels of data completeness, Arqiva is helping water companies to meet regulatory targets and push for a wate...

28/07/2025

4 Spotify Tips to Create the Perfect Summer Soundtrack

Summer is here, and whether you're road-tripping, relaxing poolside, or hosting friends for a backyard barbecue, the right soundtrack can make every moment ...

28/07/2025

Spotify Launches the Amplifika Creators Initiative to Empower Black Podcasters in Brazil

In 2021, Spotify launched Amplifika in Brazil as a dedicated program to foster t...

28/07/2025

7 Can't-Miss Audiobooks Available in Spotify Premium

Summer is the perfect time to dive into a new story, whether you're on the move or just looking for an escape. With Spotify Premium, eligible listeners in s...

28/07/2025

IABM confirms new Members Board for 2025 during record-at...

IABM, the International Trade Association for Broadcast and Media Technology, has confirmed the appointment of its Members' Board for 2025, following the co...

28/07/2025

Media Prima Strengthens with DHD SX2 Audio Systems for Ne...

Media Prima has chosen DHD SX2 audio production mixers for integration into new broadcast studios at Balai Berita in Bangsar on the southwest periphery of Kuala...

28/07/2025

MNC Software secures landmark transmitter project with St...

MNC Software, a global leader in network management and operational support systems tailored to the broadcast and media industry, has won a major monitoring and...

28/07/2025

Netflix Unveils the Official Trailer for the Limited Series 'Two Graves', Premiering August 29th

Back to All News Netflix Unveils the Official Trailer for the Limited Series Tw...

28/07/2025

New Korean Romantic Comedy Take Charge of My Heart' Production and Cast Confirmed

Back to All News New Korean Romantic Comedy Take Charge of My Heart' Produ...

28/07/2025

All Ireland Football Final draws a peak of over one million TV viewers to RT One & 378,000 streams on RT Player

Kerry's dominant All Ireland Football Final display draws a peak of over one...

28/07/2025

All Ireland Football Final draws a peak of over one million TV viewers & 378,000 streams on RT Player

Kerry's dominant All Ireland Football Final display draws a peak of over one...

28/07/2025

How New GB300 NVL72 Features Provide Steady Power for AI

The electrical grid is designed to support loads that are relatively steady, such as lighting, household appliances, and industrial machines that operate at con...

28/07/2025

VEON's Beeline Kazakhstan Opens New Office in Almaty Supporting the Digital Economy of Kazakhstan

28 Jul 2025 VEON's Beeline Kazakhstan Opens New Office in Almaty Supporting...

28/07/2025

Tour de France Femmes: Gravity Media France on Overlapping Schedules and Athlete Accessibility

New classic: EMG / Gravity Media France on overlapping schedules and athlete acc...

28/07/2025

Indiana Pacers Sports & Entertainment's Emily Wright on the IP-based Tech Transformation at Gainbridge Fieldhouse

Indiana Pacers Sports & Entertainment's Emily Wright on the IP-based Tech Tr...

28/07/2025

Live From National Baseball Hall of Fame Induction: Cooperstown Is at the Heart of MLB Network's Coverage

Live From National Baseball Hall of Fame Induction: Cooperstown Is at the Heart ...

28/07/2025

SVG Attendees Get Shared Reality' Treatment at Cosm Experience & Tech Tour in L.A.

SVG Attendees Get Shared Reality' Treatment at Cosm Experience & Tech Tour ...

28/07/2025

Second official teaser released for IT: Welcome to Derry, ahead of launch on Sky and streaming service NOW this October

Monday 28 July 2025 To view this content, please enable our use of cookies. To ...

28/07/2025

LinkedIn Wins Legal Battle to Protect Member Data

LinkedIn Wins Legal Battle to Protect Member Data Published on Jul 28, 2025 Categories: Company News LinkedIn Corporate Communications Share LinkedIn ...

26/07/2025

IABM Confirms New Members' Board for 2025

IABM, the International Trade Association for Broadcast and Media Technology, has confirmed the appointment of its Members' Board for 2025, following the co...

26/07/2025

Sinclair Acquires Non-Licensed Assets of WDKA and KBSI

BALTIMORE In another sign that dealmaking for U.S. TV stations may be heating up amid hopes that regulators will eliminate or loosen broadcast ownership caps, S...

26/07/2025

wTVision Inks Distribution Deal with Adistec for the Americas

LISBON wTVision, a provider of real-time graphics and broadcast services, has established a strategic alliance with Adistec that will see Adistec will distribut...