Live Production Software Forums

Welcome Guest! To enable all features please Login or Register.



Go to last post Go to first unread
#1 Posted : Tuesday, June 24, 2014 10:27:42 AM(UTC)

Rank: Newbie

Groups: Registered
Joined: 6/18/2014(UTC)
Posts: 2

Hi all,

Has anyone successfully used the API from C++ code. I've been trying to get a code running that could make a few simple commands (like Cut, Zoom, Fade etc.) and haven't had much luck.

I guess I'm having trouble with the HTTP client in my C++ code. Downloaded C++ REST SDK (Casablanca) to do the job, but I'm having trouble putting the syntax together.

I know the actual http requests would look something like this:

But how can I call this from C++?

Forgive me, as I'm very new to the protocol.

Am I on the right track with something like this?

web::http::client::http_client client(U(""));
client.request(web::http::methods::GET, U("/api/?Function=Cut"));


#2 Posted : Saturday, June 28, 2014 5:34:44 AM(UTC)

Rank: Newbie

Groups: Registered
Joined: 6/13/2014(UTC)
Posts: 5
Location: Sweden

Was thanked: 2 time(s) in 2 post(s)
Hi, I'm a developer as well, but I'm coding in C#.

At first, I also tried to send Http requests that way. When a request is received vMix sends out a response. If the request is successful the response is 200, if an error occurred the response should be 500. If the request is (supposedly) empty, the response is an XML-file holding useful information about most things in vMix. And I only received the XML-file. This is probably because I'm also new to web requests.

How I solved this is I used the WebBrowser class in C# to simply call
myWebBrowser.Navigate(new Uri("http://myIpAddressUrl/api/?Function=someFunction"));

which navigates the browser to that specific address. I'm not showing the web browser in the UI, not even letting the user know how things are done. Navigating to the Url in your favourite web browser also sends the function to vMix, which was how I figured this would work.

I haven't used C++ as of yet, but a quick search on Google tells me something similar to what I do is possible there as well, so you might use that. It's dirty, but it works.

To answer your question, I have no idea if you're on the right track, but if you want a dirty fix, a web browser works just fine.

thanks 1 user thanked drklump for this useful post.
madness on 6/28/2014(UTC)
#3 Posted : Tuesday, July 1, 2014 5:39:27 PM(UTC)

Rank: Newbie

Groups: Registered
Joined: 7/1/2014(UTC)
Posts: 5
Location: UK

Looking on the project site, it seems to have an example web request. Maybe try this code?

In C#, the web browser class is maybe a bit overkill as there is a dedicated WebRequest class.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.