Simple HTTP Connector For Flows

app
tools

#1

Simple HTTP Connector For Flows

Check it out the full description in the store : https://apps.athom.com/app/com.internet

image

Feedback is welcome!
Happy hacking!

19-sep-2017: Version 2.0.0 is published.
Minor bugfixes and rewrite to SDK v2

02-01-2017: Version 1.5.0 is published. A lot has happened since 1.3.3. I added support for white-listed unauthorized API calls (check the settings page). Also added more JSONpath logic cards, a POST trigger and XML cards.
08-08-2016: Version 1.3.3 is now published. The better logic card now supports Number typed variables.
02-07-2016: Version 1.3.0 is now published. A new action card for setting Better Logic variables is added.
31-05-2016: Version 1.2.1 is now published. It has now a build in timeout on request of 30 seconds. With the geek http options you can set {“url”: “http://www.athom.com”, “timeout”: milliseconds} if you want a custom timeout.
04-05-2016: Version 1.2.0 is now published in the app store. It allows disabling the authorization on the API (restart app after settings change) and some geeky stuff with http options.
26-04-2016: Update: version 1.0.0 is now released. It has a breaking change for API users: API calls for flow triggers now require the authorization header.

Support thread for https://apps.athom.com/app/com.internet as a continuation of the old forum thread (https://forum.athom.com/discussion/770/app-simple-http-connector-for-flows-2-0-0/)


#2

Basically what I want to do is using the REST api from DSMR Reader. When doing a ‘get’ you need to always include an certain (API key) header. With cURL this works just fine, but I’m now trying to let Homey extract a certain value and put it Better Logic. Is it possible to use one of the HTTP Connector cards for this?

According the API documentation you can call either:

cURL:

curl 'http://YOUR-DSMR-URL/api/v2/datalogger/dsmrreading' \
     -H 'X-AUTHKEY: YOUR-API-KEY' | python -m json.tool

Or with requests (Python):

import requests
import json

response = requests.get(
    'http://YOUR-DSMR-URL/api/v2/datalogger/dsmrreading',
    headers={'X-AUTHKEY': 'YOUR-API-KEY'},
)

if response.status_code != 200:
    print('Error: {}'.format(response.text))
else:
    print('Response: {}'.format(json.loads(response.text)))

So the question really is, how can I include a HTTP header?


#3

Take a look at the advanced options.

In your case, try this:

{"method":"get","protocol":"http:","hostname":"YOUR-DSMR-URL","path":"/api/v2/datalogger/dsmrreading","headers":{"X-AUTHKEY":"YOUR-API-KEY"}}

#4

@robertklep You are the best, this worked like a charme! Thumbs up and thank you very much! +1