Getting variable value via HTTP GET

71 views
Skip to first unread message

maxi...@googlemail.com

unread,
Jul 30, 2018, 5:53:05 PM7/30/18
to Apilio
Hello there,

first of - thanks for creating this nifty tool.

I'm trying to retrieve the current value of a variable via a HTTP request, but I can't seem to find the functionality.
Is it possible to just do a curl -X GET https://apilio.herokuapp.com/boolean_variables/.../get/with_key/1234 and retrieve a simple 1 or 0 depending on the variable's value?
I'd like to poll that url every five minutes to trigger a shell script without having to expose a port to the net.

Thanks a lot in advance,

pebneter

unread,
Aug 7, 2018, 12:52:29 AM8/7/18
to Apilio
Hi,

I get to hear that question more frequently these days -  very interesting!
Your findings are correct: This functionality is currently not implemented. But I see the value of it and will consider it as an feature to add in the future.

In the meantime, you can get there with a little workaround and an undocumented feature.
If you make a logicblock "evaluate" call and add .json at the end of the URL, you will get the result in JSON. So if you create a logicblock with just one boolean variable connected, you can actually read out that value with this trick.

Thanks!
Philipp

maxi...@googlemail.com

unread,
Aug 7, 2018, 4:09:18 AM8/7/18
to Apilio
Hi,

Thank you for your reply! That undocumented feature is indeed exactly what I was looking for!

There is only one issue with that approach : apilio requires log in through my Google account before granting access to the json URL.
Regular variables can be set without prior authentification, which simplifies matters quite a bit.

Is there a best practice you recommend for accessing the json from e.g. curl?

Thanks again,
Maximilian

pebneter

unread,
Aug 7, 2018, 12:40:21 PM8/7/18
to Apilio
Hi Maximilian,

you don't need to authenticate with username and password for that call. That works with the authentication key. The URL looks something like this: https://apilio.herokuapp.com/logicblocks/your_logicblock/evaluate/with_key/77xxxxxxxxxxxx98.json

I have no recommendation for how to consume the JSON - curl should be fine of course.

Philipp

unread,
May 31, 2019, 5:06:08 AM5/31/19
to Apilio
Hi there,
we have started implementing a very early version of an API. We launched it sliently today!

Try it out and tell us what you think! Is this the right direction? Does it add value?

Cheers
Philipp
Reply all
Reply to author
Forward
0 new messages