Jump to content

Welcome to Smart Home Forum by FIBARO

Dear Guest,

 

as you can notice parts of Smart Home Forum by FIBARO is not available for you. You have to register in order to view all content and post in our community. Don't worry! Registration is a simple free process that requires minimal information for you to sign up. Become a part of of Smart Home Forum by FIBARO by creating an account.

 

As a member you can:

  •     Start new topics and reply to others
  •     Follow topics and users to get email updates
  •     Get your own profile page and make new friends
  •     Send personal messages
  •     ... and learn a lot about our system!

 

Regards,

Smart Home Forum by FIBARO Team


  • 0

[SOLVED] [API] POST: Scene Action Start with parameters


Dave_H

Question

I'm trying to start a scene from HA-Bridge using the Scene Action API using a POST HTTP call.  It works fine if there are no parameters being passed in the message body, but as soon as I add a parameter, then it returns HTTP 405 (Method not allowed).  So I tried calling the API from SoapUI and I get a 405 returned there also.  HOWEVER if I call the API from a browser using the /docs Try It! helper (

Please login or register to see this link.

), then it works fine.

 

So I trapped the message being sent from the browser (the one that is working), and I get:

Please login or register to see this code.

The message that I'm sending from SoapUI is:

Please login or register to see this code.

I've tried modifying the headers in SoapUI so that they all match the browser values, and I still get the error.

 

Anyone got any ideas as to why it's not working?

 

Thanks,

Dave

Edited by Dave Harrison
Solved
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 1
  • Inquirer
  • This is now working :D.  I noticed that the connection would work correctly in SoapUI when 'Preemptive Authentication' was turned on (not at all sure why :?).  Therefore, realising that it was authentication related, I changed the request in HA-Bridge to provide the authentication via the HTTP headers, rather than via the URL.

     

    So for anyone else looking to do the same, this is how it's configured in HA-Bridge:

    Please login or register to see this code.

    Where <nn> is the scene number, eg:

    Please login or register to see this code.

    And the value in the HTTP Header after the word 'Basic' is your Fibaro user id and password separated by a colon, and encoded in Base64.  Use a site, such as 

    Please login or register to see this link.

     to do this encoding for you.  So for example:

    Please login or register to see this code.

    becomes:

    Please login or register to see this code.

    In the scene, you can read the parameters using the fibaro:args() function, eg:

    Please login or register to see this code.

    Dave

    Edited by Dave Harrison
    • Thanks 1
    Link to comment
    Share on other sites

    • 0
  • Inquirer
  • Full solution now posted to Crowd's Solutions/Other Solutions: 

     

    Link to comment
    Share on other sites

    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.

    Guest
    Answer this question...

    ×   Pasted as rich text.   Paste as plain text instead

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.

    ×
    ×
    • Create New...