Using web API POST/GET please help.

Ask a question about the usage of QLC+ with the Windows operating system
Post Reply
shirec
Posts: 4
Joined: Wed Feb 15, 2017 1:23 am
Real Name: G Colella

I am currently trying to get the QLC web API to work with POST and GET. I can't find any links to make it work. What commands does the web API accept?
.
I am attempting to use it with a home automation system called homeseer. They have functions such as hs.geturl and hs.urlaction. I for the life of me cant figure out why there is no information anywhere on this. Any help would be appreciated.
siegmund
Posts: 703
Joined: Mon Nov 02, 2015 11:03 am
Location: Germany
Real Name: Lukas

You may use the web API test page: http://www.qlcplus.org/Test_Web_API.html
I didn't use it already, so I can't provide more information, but this should take you a step further.
shirec
Posts: 4
Joined: Wed Feb 15, 2017 1:23 am
Real Name: G Colella

I have seen this already and put a link to the web page in the homeseer forum. They then requested specific commands.

I feel it has something to do with the code below to change it but I am still now sure how POST and GET work. What specific POST line would it take to cause a change. The value of the widget I want to use is 31. 0 = off and 255 = on.

Any ideas?

Code: Select all

<div class="apiButton" onclick="javascript:vcWidgetSetValue('basicWidgetID', 'basicWidgetValue');">Basic widget value set</div>

   Widget ID:<input id="basicWidgetID" type="text" value="0">
   Value:<input id="basicWidgetValue" type="text" value="255">
  </td>
  <td colspan="2">
    This API is the direct way to set a Virtual Console widget value. It can be used for Buttons, Sliders and
    Audio Triggers. The value to set depends on the widget type itself. Buttons and Audio triggers will only support values 0 (= off) and 255 (= on) while Sliders will accept all the values in the 0-255 range.
  </td>
User avatar
mcallegari
Posts: 4446
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

The QLC+ web interface doesn't work by GET and POST while operating on the Virtual Console. It works with a websocket.

GET is only used to retrieve a page (e.g virtual console, simple desk, etc.) while POST is used to upload a file (e.g project workspace, user fixture)

I suggest you to go back to the API sample page and study it a bit. All you need is in there
shirec
Posts: 4
Joined: Wed Feb 15, 2017 1:23 am
Real Name: G Colella

Really appreciate the help. I have been studying it furiously and will continue to do so. In the mean time, I will add a code block to the homeautomation code that it wants me to conform to. If by looking at this you can see I am clearly in the wrong place and it will never work please let me know.

Code: Select all

URLAction

Purpose

This command provides access to HomeSeer's internal Internet control.  With it, you can post data to a web server, or get the headers from a web page.

Following are a few simple examples of the various "actions" that can be performed with this command:

POST
(Posts data to the server)

dim s
const server_url = "http://someserver.com/datapost/hereitis.html"
const headers="Content-Type: application/x-www-form-urlencoded"  

s = hs.URLAction(server_url, "POST", data, headers)

GET
(Retrieves a web page - see GetURL)

dim s
dim data
const website = "http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=homeseer"

s = hs.URLAction(website, "GET", "", "")

HEAD
(Retrieves web page headers)

dim s

s = hs.URLAction("http://someserver.com/data/homepage.htm", "HEAD", "", "")

PUT
(Replaces [puts] a file at the URL)

dim s
dim sPage
dim sHead

sPage = (routine to read a file into the variable sPage)

s = hs.URLAction("http://someserver.com/putithere/putit.htm", "PUT", sPage, "")

Parameters

Parameter: url
Type: string
Description: This is the URL to post to.

Parameter: action
Type: string
Description: This is the action for the URLAction command, which is one of POST, PUT, HEAD, or GET.

Parameter: data
Type: string
Description: This is the URL data parameters.

Parameter: headers
Type: string
Description: This is the web page headers.

Returns

Return value: web page
Type: string
Description: This is the returned web page from the URLAction command, if any.
shirec
Posts: 4
Joined: Wed Feb 15, 2017 1:23 am
Real Name: G Colella

I have just been asked if there is a http api for QLC. If there is not then this probably is not going to work and I will have to find a new program. I do appreciate all the help people are trying to give me.
User avatar
mcallegari
Posts: 4446
Joined: Sun Apr 12, 2015 9:09 am
Location: Italy
Real Name: Massimo Callegari
Contact:

Again, you need to use a websocket. Please read my previous post again.
hutje
Posts: 46
Joined: Tue Nov 24, 2015 6:10 pm
Location: The Netherlands
Real Name: Robin

I want to use http request to make a widget button high. Is there a way this could be triggered bij using a http request?
janosvitok
Posts: 1265
Joined: Mon Apr 13, 2015 7:05 am
Location: Bratislava, Slovakia
Real Name: Jano Svitok
Contact:

See above. I think it's clear enough. Either you use websockets or implement GET/POST support yourself in C++.
justinh
Posts: 6
Joined: Tue Nov 15, 2016 5:03 am
Real Name: Justin

Hi all,

I would recommend everyone look into Node Red.

It's simple 'Drag and Drop' software that can be used to convert TCP / UDP / HTTP commands to web socket commands that can be used to control QLC+.
By using Node Red, I can send TCP commands from my Control System (iPad) to QLC+ and also receive feedback from Node Red for Channel Values etc.

You can easily make the commands HTTP as well in Node Red if that's what you would prefer.
hutje
Posts: 46
Joined: Tue Nov 24, 2015 6:10 pm
Location: The Netherlands
Real Name: Robin

Could you send me an example of the way you have this done in Node Red?
I use Node Red with MQTT for home automation, but if I can control QLC+ with it, it would be very usefull!

Currently I have made Quizbuttons which works with MQTT and Node Red, but if I can connect these with QLC+, the lights can turn to a certain color when button is pressed.
So all lights are going red when team red pressed the button, blue when team blue pressed etc.

Looking forward!

EDIT1:
Found artnet support in Node Red, soon I will test this!
http://flows.nodered.org/node/node-red-contrib-artnet
Post Reply