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: http://127.0.0.1:8088/api/?Function=Cut http://127.0.0.1:8088/api/?Function=Fade http://127.0.0.1:8088/api/?Function=Zoom 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("http://10.190.80.151:8088")); client.request(web::http::methods::GET, U("/api/?Function=Cut")); Thanks!
|
|
|
|
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 Code: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. /Kristoffer
|
1 user thanked drklump for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/1/2014(UTC) Posts: 5 Location: UK
|
|
|
|
|
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.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close