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

JSON headache...


Guest jcs10

Question

Guest jcs10

Hello,

I'm still trying to understand how JSON is working,

Here what I saw in the docs :

Please login or register to see this code.

Here what sen.se is waiting :

Authentication via URL parameter

Please login or register to see this link.

?sense_key=MyKey'>

Please login or register to see this link.

?sense_key=MyKey

Publishing events

Your device can publish events (send data) in one of its feeds by making an HTTP POST request. POST data have to be formated in JSON. The endpoint for publishing events in a feed is

Please login or register to see this link.

For example if you would like to publish an event with value 45 in Feed #123 you would POST the following JSON:

{

"feed_id": 123,

"value": 45

}

If this event has been successfully published, you will get a 200 status code as a response along with the following data:

Here what I try to do : (publishing a simple value to the feed 28120)

Please login or register to see this code.

But nothing is working (nothing published)

They are talking about this too :

No matter what method you want to use, you need to set the content-type as "application/json" in the header of your http request :

header = {"Content-type": "application/json"}

Can someone help me ?

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0
Guest deraaij
  • Inquirer
  • Hello,

    I'm still trying to understand how JSON is working,

    Here what I saw in the docs :

    Please login or register to see this code.

    Here what sen.se is waiting :

    Authentication via URL parameter

    Please login or register to see this link.

    ?sense_key=MyKey'>

    Please login or register to see this link.

    ?sense_key=MyKey

    Publishing events

    Your device can publish events (send data) in one of its feeds by making an HTTP POST request. POST data have to be formated in JSON. The endpoint for publishing events in a feed is

    Please login or register to see this link.

    For example if you would like to publish an event with value 45 in Feed #123 you would POST the following JSON:

    {

    "feed_id": 123,

    "value": 45

    }

    If this event has been successfully published, you will get a 200 status code as a response along with the following data:

    Here what I try to do : (publishing a simple value to the feed 28120)

    Please login or register to see this code.

    But nothing is working (nothing published)

    They are talking about this too :

    No matter what method you want to use, you need to set the content-type as "application/json" in the header of your http request :

    header = {"Content-type": "application/json"}

    Can someone help me ?

    Unfortunately it is not yet possible to use custom headers, they are working on it though.

    Link to comment
    Share on other sites

    • 0
    Guest jcs10
  • Inquirer
  • Thank you for your answer.

    Is this a custom header ? seems for me to be a usually one.

    Link to comment
    Share on other sites

    • 0
    Guest deraaij
  • Inquirer
  • Thank you for your answer.

    Is this a custom header ? seems for me to be a usually one.

    I don't think so. You could check with wireshark.

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