JSON Documentation

Christie Widget Designer Version 6 - Q&A

Moderator: Moderator Group

Forum rules
When asking make sure to include the operating system and the revision of Widget Designer you are using.

JSON Documentation

Postby djrappa » Tue Mar 13, 2018 9:43 am

It's unfortunate that there is no documentation for the JSON commands in the Online Manual still...

I need to try and backwards engineer something...

from the location http://192.168.1.41/fixtures in need to fetch the json value for activeCount

However no matter what I am trying as the syntax using JsonRequestToVar I am not seeing anything pull into my variable.

Can anyone assist with what he correct Syntax should be?

Thanks
Cheers
Clint Dulieu
Dulio Design
djrappa
 
Posts: 183
Joined: Wed Jul 01, 2009 10:46 am

Re: JSON Documentation

Postby Dennis Kuypers » Tue Mar 13, 2018 12:16 pm

Hello,

There is a search feature (click on the magnifying glass icon) that shows these results for the query "JSON":
http://manual.coolux.de/#using-json.htm
http://manual.coolux.de/#data-type-specific-members.htm#json_member

To be more flexible, retrieve it as a string using HTTPRequestToVar(URL,"VarName"), then you can use VarName.ToJson() to get a json object. This allows you to use .GetInteger("activeCount") on the json object to get the value as a number.

Regards
Dennis
Dennis Kuypers
(former Product Developer, Software)
Dennis Kuypers
coolux Germany
 
Posts: 771
Joined: Thu Jul 05, 2012 12:18 pm

Re: JSON Documentation

Postby djrappa » Tue Mar 13, 2018 1:00 pm

Sorry what I was referring to is the JSON commands are not listed in the command section of the manual, nor do they give examples or prompt as you enter them as scripts...

Unfortunately my solution isn't as easy as we would like. Because the URL doesn't actually return the Json value as it would be displayed say if you visited the page in browser, but rather the source code which only lists the Json placeholder as it appears the webpage is using javascript to call the value from somewhere else.

The manufacturer is not being forthcoming with the information required to make it work so sadly backwards engineering is our only option. All I know is it is calling a json query from the /fixtures location however a HTTP request of that same location just returns nothing (I presume it's a 404 error).
Cheers
Clint Dulieu
Dulio Design
djrappa
 
Posts: 183
Joined: Wed Jul 01, 2009 10:46 am

Re: JSON Documentation

Postby Dennis Kuypers » Tue Mar 13, 2018 9:24 pm

Hello,

just visit the site with chrome or firefox. In the developer console you should see the transactions with their URLs.

Regards
Dennis
Dennis Kuypers
(former Product Developer, Software)
Dennis Kuypers
coolux Germany
 
Posts: 771
Joined: Thu Jul 05, 2012 12:18 pm

Re: JSON Documentation

Postby djrappa » Tue Mar 13, 2018 11:28 pm

No such luck, the site requests the information by sending a POST query for json data to "/fixtures"
If I attempt to visit /fixtures I simply get a 404 error unfortunately.
Cheers
Clint Dulieu
Dulio Design
djrappa
 
Posts: 183
Joined: Wed Jul 01, 2009 10:46 am

Re: JSON Documentation

Postby Dennis Kuypers » Wed Mar 14, 2018 1:37 am

Hello,

But you can use the website?
Use the web interface with the developer tools open. Any call made from the website to the API will be logged.

Regards
Dennis
Dennis Kuypers
(former Product Developer, Software)
Dennis Kuypers
coolux Germany
 
Posts: 771
Joined: Thu Jul 05, 2012 12:18 pm

Re: JSON Documentation

Postby djrappa » Thu Mar 15, 2018 2:56 pm

Hi
I have managed to get a little more info but still need some help for the last steps...

This is what I got from the manufacturer:

The request needs to be a http POST e.g.

curl -X POST http://172.30.2.20/fixtures -d '{"request":"update_devices"}'

which returns:

{"activeCount":1,
"bridges":[],
"fixtureCount":1,
"fixtures":[
{"firmware":"2.0.4",
"mac":"00:00:6c:73:ff:fe",
"moustacheId":0,
"name":"LC1140+",
"number":1,
"objectId":0,
"online":true,
"position":"3.34, 3.34 px",
"rotation":"0°",
"serial":"SIM1_lithium",
"temp":"41°C (105°F)"}],
"groups":[],
"nodeLookup":{"0":"6"}}


So with this information can I get these values into widget designer using the URL request or the JSON request commands?

Thanks very much
Cheers
Clint Dulieu
Dulio Design
djrappa
 
Posts: 183
Joined: Wed Jul 01, 2009 10:46 am

Re: JSON Documentation

Postby Dennis Kuypers » Fri Mar 16, 2018 4:43 pm

Hello,

there is currently no command to do POST requests. You could build one yourself, but reading the result is rather tricky.

You should file a feature request with our support team to get this added. It's also helpful to post this in the feature request forum so that we can see if others have interest in this as well!

Regards
Dennis
Dennis Kuypers
(former Product Developer, Software)
Dennis Kuypers
coolux Germany
 
Posts: 771
Joined: Thu Jul 05, 2012 12:18 pm


Return to Widget Designer V6

Who is online

Users browsing this forum: No registered users and 16 guests

cron