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

change variable with rest api


jompa68

Question

Hi again

 

searched around in all my documents and on forum how-to change a variable through a http request, im sure it was possible in version 4.x. Right?

Please login or register to see this code.

  ... then what?

 

//Jonny

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Thought I head a ready-made solution but can't find it... or dreamed it...

As far as I know, and /docs confirms, you have to POST a payload to create one and PUT to change one. I've got an example from this forum somwhere: "to create a new global variable in our system you would send POST on IP/api/globalVariables with payload looking like this: '{"name":"example","value":"2"}'.

Link to comment
Share on other sites

  • 0

Hi,

 

you can find a solution here

Please login or register to see this link.

 

If you succesfully trigger a scene by changing a globalvar by rest-api, let me know. I tried it a lot of times, but without success.

Link to comment
Share on other sites

  • 0

With curl, you can do this:

 

in 4.X

curl -X PUT -d "{\"name\":\"${variable}\",\"value\":\"${value}\"}" "http://${userid}:${pass}@${HCIP}/api/globalVariables/${variable}"

 

in 3.X

curl -X PUT -d "{\"name\":\"${variable}\",\"value\":\"${value}\"}" "http://${userid}:${pass}@${HCIP}/api/globalVariables"

Link to comment
Share on other sites

  • 0

Hi diderik,

 

have you any idea who it works to trigger a scene by change a global var value by rest-api?

Best regards

thorsten

Link to comment
Share on other sites

  • 0

in 4.X

Please login or register to see this code.

Actually this would fit it also:

Please login or register to see this code.

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...