This is the forum archive of Homey. For more information about Homey, visit the Official Homey website.

The Homey Community has been moved to https://community.athom.com.

This forum is now read-only for archive purposes.
Official

[APP] Simple HTTP Connector For Flows (2.0.0)

1568101114

Comments

  • T-mo-T said:
    Anyone knows if the GET method also supports parsing of xml data? I'm trying to build a flow using 'HTTP request' to get the status xml from my Denon receiver (http://192.168.1.13/goform/formMainZone_MainZoneXml.xml) and I want to check if the receiver is turned on (check if "<Power><value>ON</value></Power>" is present in the xml response) so I can set this as a global variable. I'm afraid this cannot be achieved (yet), any ideas?
    No, xml parsing is not supported for now. Are there more use cases out there that needs a xml variant of the json value getter?
    Ah okay, that's what I thought indeed, but thanks for confirming!

    Well, for my (Denon) receiver the only way to get feedback from the receiver is to read/parse the xml (to get information regarding power, volume, listening mode, etc). I can't think of other use cases right now, but I think in general there're way more devices/web services that can only provide xml responses.
  • Hello!
    Does anyone know if it is possible to do a GET request(to external API) with a Basic Auth in the header. If it is possible, could you explain how to? 
    Did try some stuf but can't get it to work :neutral: 
    Thanx in advance :wink: 

  • PBaan93 said:
    Hello!
    Does anyone know if it is possible to do a GET request(to external API) with a Basic Auth in the header. If it is possible, could you explain how to? 
    Did try some stuf but can't get it to work neutral 
    Thanx in advance wink 

    You can use the very geeky 'HTTP Geek Request' action. It requires you to put the url and all details in a valid json formatted nodejs HTTP options string (https://nodejs.org/api/http.html#http_http_request_options_callback). 

    Example:
    {"method":"put","protocol":"https:","hostname":"httpbin.org","path":"/put","headers":{"User-Agent":"Node.js http.min"}}
  • PBaan93 said:
    Hello!
    Does anyone know if it is possible to do a GET request(to external API) with a Basic Auth in the header. If it is possible, could you explain how to? 
    Did try some stuf but can't get it to work neutral 
    Thanx in advance wink 

    You can use the very geeky 'HTTP Geek Request' action. It requires you to put the url and all details in a valid json formatted nodejs HTTP options string (https://nodejs.org/api/http.html#http_http_request_options_callback). 

    Example:
    {"method":"put","protocol":"https:","hostname":"httpbin.org","path":"/put","headers":{"User-Agent":"Node.js http.min"}}
    Thanks for helping, verry nice! That part I understand now. Last question, how do I get my JSON respond?
  • PBaan93 said:
    PBaan93 said:
    Hello!
    Does anyone know if it is possible to do a GET request(to external API) with a Basic Auth in the header. If it is possible, could you explain how to? 
    Did try some stuf but can't get it to work neutral 
    Thanx in advance wink 

    You can use the very geeky 'HTTP Geek Request' action. It requires you to put the url and all details in a valid json formatted nodejs HTTP options string (https://nodejs.org/api/http.html#http_http_request_options_callback). 

    Example:
    {"method":"put","protocol":"https:","hostname":"httpbin.org","path":"/put","headers":{"User-Agent":"Node.js http.min"}}
    Thanks for helping, verry nice! That part I understand now. Last question, how do I get my JSON respond?
    Hmm.. if you want to combine this method with the 2-step 'get value and trigger flow with it' method I need to create a new card for you...
  • PBaan93 said:
    PBaan93 said:
    Hello!
    Does anyone know if it is possible to do a GET request(to external API) with a Basic Auth in the header. If it is possible, could you explain how to? 
    Did try some stuf but can't get it to work neutral 
    Thanx in advance wink 

    You can use the very geeky 'HTTP Geek Request' action. It requires you to put the url and all details in a valid json formatted nodejs HTTP options string (https://nodejs.org/api/http.html#http_http_request_options_callback). 

    Example:
    {"method":"put","protocol":"https:","hostname":"httpbin.org","path":"/put","headers":{"User-Agent":"Node.js http.min"}}
    Thanks for helping, verry nice! That part I understand now. Last question, how do I get my JSON respond?
    Hmm.. if you want to combine this method with the 2-step 'get value and trigger flow with it' method I need to create a new card for you...
    Hmm.. To bad. But i would realy like that :blush: 
    Tell me if i can help in anyway. Great app btw, sad you have to manny different types of HTTP request to take into account, makes your job harder.
  • ErikVanDongenErikVanDongen Member
    edited May 2016
    Ok. Working on a solution now: Every card can turn into a geek card when you put http options in instead of a url.
    So the geek card wil depricate soon.
  • 0burner0 said:
    Is it possible to create a link such as : http : // < homeyip > / <flow name>
    
    Once the link is opened that will run a flow.
    
    I want to put these shortcuts as links in my phone so that it becomes a kind of remote .
    
    The standard app with all machine I do not work fine . I prefer that I can serve my flows.


    I cant get it working.
    If some one can help me :)

    What did I do:

    Create a flow:
    If (card) Get request: test1   then say test1

    Then pushed  ctrl+shift+j
    Got a token "e6d99****************************e"
    (have no clue when I need the token but I have got it)

    Then went to:
    http://192.168.8.15/api/app/com.internet/test1

    Got this error:
    {"status":401,"result":"no_auth_method_found"}
    
    
    I think I need to enter the token some where, but where and how?
  • PeaoPeao Member
    Jesper said:
    I'm pretty new to all this and hopefully anybody here can help me to get started with the http Homey app in combination with the app Tasker in android.

    I want to change a variable in Homey everytime my phone connects and disconnects to my WiFi network. So I guess I have to set a rule in Tasker that when my phone connects to WiFi I have to let Tasker do a HTTP Post to Homey and then in Homey I have to use the incoming get request card as a trigger. Is this correct?

    Could anybody share some print screens with me (on the forum or via mail if it is to difficult to explain on the forum). I believe I have to use the following action card in Tasker but I don't know what I exactly need to enter in each field so that Homey receives the HTTP post.



    Any help would be greatly appreciated :).
    I am interested in this aswell. Didn't found an answer here.  There is also a HTTP Get action in tasker. Maybe this would work. But I have no clue where i should insert the required bearer token.
  • 0burner0 said:
    0burner0 said:
    Is it possible to create a link such as : http : // < homeyip > / <flow name>
    
    Once the link is opened that will run a flow.
    
    I want to put these shortcuts as links in my phone so that it becomes a kind of remote .
    
    The standard app with all machine I do not work fine . I prefer that I can serve my flows.


    I cant get it working.
    If some one can help me :)

    What did I do:

    Create a flow:
    If (card) Get request: test1   then say test1

    Then pushed  ctrl+shift+j
    Got a token "e6d99****************************e"
    (have no clue when I need the token but I have got it)

    Then went to:
    http://192.168.8.15/api/app/com.internet/test1

    Got this error:
    {"status":401,"result":"no_auth_method_found"}
    
    
    I think I need to enter the token some where, but where and how?
    You need version 1.1.0 and disable Authorisation.
  • Ok. Working on a solution now: Every card can turn into a geek card when you put http options in instead of a url.
    So the geek card wil depricate soon.
    Ok, resubmitted a new version to the app store (version 1.2.0).
    In this version its possible to put json formatted http options in every card instead of a url. 
    It also support XML parsing in the 'Get variable step 1' card! (XML results are converted to JSON).
    Oh.. and also added realtime logging. So when using my logger page you get a lot of debug information.
  • T-mo-T said:
    Anyone knows if the GET method also supports parsing of xml data? I'm trying to build a flow using 'HTTP request' to get the status xml from my Denon receiver (http://192.168.1.13/goform/formMainZone_MainZoneXml.xml) and I want to check if the receiver is turned on (check if "<Power><value>ON</value></Power>" is present in the xml response) so I can set this as a global variable. I'm afraid this cannot be achieved (yet), any ideas?
    No, xml parsing is not supported for now. Are there more use cases out there that needs a xml variant of the json value getter?
    Supported with version 1.2.0.
  • ErikVanDongenErikVanDongen Member
    edited May 2016
    Peao said:
    Jesper said:
    I'm pretty new to all this and hopefully anybody here can help me to get started with the http Homey app in combination with the app Tasker in android.

    I want to change a variable in Homey everytime my phone connects and disconnects to my WiFi network. So I guess I have to set a rule in Tasker that when my phone connects to WiFi I have to let Tasker do a HTTP Post to Homey and then in Homey I have to use the incoming get request card as a trigger. Is this correct?

    Could anybody share some print screens with me (on the forum or via mail if it is to difficult to explain on the forum). I believe I have to use the following action card in Tasker but I don't know what I exactly need to enter in each field so that Homey receives the HTTP post.



    Any help would be greatly appreciated .
    I am interested in this aswell. Didn't found an answer here.  There is also a HTTP Get action in tasker. Maybe this would work. But I have no clue where i should insert the required bearer token.
    Use the 'GET' method. This thread explains how to configure the authorization header in Tasker.
    With version 1.1.0 you can disable authentication on the HTTP app API.

  • FrakkeFrakke Member
    Anyone already got this working with this awesome iOS app?
    http://homeremote.bouncingball.mobi/
  • Frakke said:
    Anyone already got this working with this awesome iOS app?
    http://homeremote.bouncingball.mobi/
    yes it did work with my iphone and iwatch but it stopped working and i dont know why.
  • Thanks Thanks Thanks!!! @ErikVanDongen ;
    I Like the new Geeky in Version 1.2 !!! Thanks!!
    a Request to Self ( ::1 ): Turn LedRing Screensaver off:



    HTTP Put JSON:
    URL>>  {"method":"put","protocol":"http:","host":"::1","path":"/api/manager/ledring/settings/","headers":{"Authorization":"Bearer Deaf001000bad1000effe000hace000215c001","Content-Type":"application/json"}}
    Option>>  {"uri":"homey:manager:ledring","name":"off","options":{}}

    or the other options:
    Option>>  {"uri":"homey:manager:ledring","name":"off","options":{}}
    Option>>  {"uri":"homey:manager:ledring","name":"rainbow","options":{}}

  • T-mo-TT-mo-T Member
    T-mo-T said:
    Anyone knows if the GET method also supports parsing of xml data? I'm trying to build a flow using 'HTTP request' to get the status xml from my Denon receiver (http://192.168.1.13/goform/formMainZone_MainZoneXml.xml) and I want to check if the receiver is turned on (check if "<Power><value>ON</value></Power>" is present in the xml response) so I can set this as a global variable. I'm afraid this cannot be achieved (yet), any ideas?
    No, xml parsing is not supported for now. Are there more use cases out there that needs a xml variant of the json value getter?
    Supported with version 1.2.0.
    VERY nice! Thanks. 
  • bvdbosbvdbos Member
    {"Authorization":"Bearer Deaf001043bad1000effe211hace000212c001","Content-Type":"application/json"}}
    Hope you edited the bearer before you posted in here :-)
  • Version 1.2.0 is now published. 
  • PBaan93PBaan93 Member
    Version 1.2.0 is now published. 
    Nice, can't weight! I will test it tomorow ;) and tell you my feeback.
  • {"Authorization":"Bearer Deaf001043bad1000effe211hace000212c001","Content-Type":"application/json"}}
    Hope you edited the bearer before you posted in here :-)
    1337

    of course
  • T-mo-TT-mo-T Member
    T-mo-T said:
    Anyone knows if the GET method also supports parsing of xml data? I'm trying to build a flow using 'HTTP request' to get the status xml from my Denon receiver (http://192.168.1.13/goform/formMainZone_MainZoneXml.xml) and I want to check if the receiver is turned on (check if "<Power><value>ON</value></Power>" is present in the xml response) so I can set this as a global variable. I'm afraid this cannot be achieved (yet), any ideas?
    No, xml parsing is not supported for now. Are there more use cases out there that needs a xml variant of the json value getter?
    Supported with version 1.2.0.
    Took me some time to understand the JSONPath principles, but I got it working! I can now parse the xml and see the status of my receiver. I like the flexible/generic implementation of this. Thanks again! Also the realtime logpage is very helpful for this. 


  • PBaan93PBaan93 Member
    @ErikVanDongen, it works like a charm! With the http options in the GET carts is can now set the authorization in the header and therefore connect to the API I wanted! Thanks.
    Got another suggestion, only if you got some spare time and you think it is a good suggestion ;).
    If I need two parts out of the JSON response, I have to do the http request twice with two different JSONpaths. Maybe select the JSONpath in the Step 2 trigger card instead of the in step 1 one card. So I have to do request only once and use multiple times the step 2 card.
  • @PBaan93 Nice to hear! 
    I understand what you proposes, but I won't implement it. I expect most API's to have a Homey App eventually. Also, testing of flow parameters syntax will be hard for a user if the actual request and JSONpath are executed on the trigger-side.
    Hope you understand my point in this.

  • PBaan93PBaan93 Member
    @PBaan93 Nice to hear! 
    I understand what you proposes, but I won't implement it. I expect most API's to have a Homey App eventually. Also, testing of flow parameters syntax will be hard for a user if the actual request and JSONpath are executed on the trigger-side.
    Hope you understand my point in this.

    I get it. No problem. Thanks
  • would it be possible for my Dreambox (satellite receiver) to operate via the app http request flow cards, I have no experience with this.
    There is an API for: http://dream.reichholf.net/wiki/Enigma2:WebInterface.
    What I can now: receiver on and off via:
    Http//dreamboxip/web/remotecontrol?command=116
    Did some tried to turn it into a flow, failed.
    Who will give me a hint where to put it ?
    Thanks.



  • Just made a quick test with my ET10000 (Extrend Enigma 2 sat receiver).

    I have managed to change the power state using the following:

    http://dreambox/web/powerstate?newstate={powerstate_number}
    • 0 = Toogle Standby
    • 1 = Deepstandby
    • 2 = Reboot
    • 3 = Restart Enigma2
    • 4 = Wakeup form Standby
    • 5 = Standby
    This works and changes the powerstate but gives an unexpected token error? Maybe someone can tell me what is unexpected?


  • Thanks fuzzybear, gone try that.

  • Hey guys. Everything after the question mark is called 'queryparameters'. Read the instructions in the appstore carefully. You need to put the queryparameters in a valid json format as a seperate parameter value in the HTTP GET JSON card.
    Google for a json validator if you're not sure how to format it.
  • Thanks Erik missed the instructions in the App Store and don't know the first thing about json let alone json validators. But I am here to learn so thanks for the pointers. Will look this up tonight when the kids have gone to bed.
Sign In or Register to comment.