Jump to content









Photo

ABout response from GET in device stream


  • Please log in to reply
6 replies to this topic

#1 supriyav

supriyav

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 17 December 2015 - 05:32 AM

Hi,

 

I tried to check the URL by using device id_developer... i tried in JAVA too as well as in hurl.it ; but response is 401 Unauthorised. it is not showing 200 ok... Can anyone help me out in it?

 

 

fr eg: https://api.carriots...riyav.supriyav/



#2 Yoleon

Yoleon

    Sugar Master

  • Members
  • PipPipPip
  • 30 posts

Posted 17 December 2015 - 09:48 AM

Hi Supriyav,

 

To do a GET petition of a device stream you need de id_developer of the stream. For example:

 

https://api.carriots...d@Yoleon.Yoleon

 

You can see the id_developer of a stream doing a GET petition to the https://api.carriots.com/streams URL and searching the stream in the list.

 

Try it on the API Console and tell me.

 

Carriots Staff



#3 supriyav

supriyav

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 18 December 2015 - 10:15 AM

Hi Yoleon

 

Thank you for the help.i Got it correct.I have one more doubt that is shall we update a value with url and send stream? 

for eg : updating the value of temperature in our device 



#4 supriyav

supriyav

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 18 December 2015 - 11:32 AM

That is i have a device named test with id_developer: test1@supriyav.supriyav with sensor type temperature. I want to update temperature with a value say 21.How is that possible in Carriots?

 

It is said to use PUT Request.But what should be filled in the Payload column? 



#5 Yoleon

Yoleon

    Sugar Master

  • Members
  • PipPipPip
  • 30 posts

Posted 18 December 2015 - 11:47 AM

Hi Supriyav,

To update the temperature of your test1@supriyav.supriyav device, you need to store the value in properties (you can add at the control panel) and create a listener that update the value when you send a stream to the test1@supriyav.supriyav device.

I hope this help you.

#6 supriyav

supriyav

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 21 December 2015 - 07:18 AM

Thank you Yoleon. its working.

I am trying to update from the URL itself. i.e. i tried java program to get the response and streams .It worked well, but is that possible to update using the URL? 



#7 Yoleon

Yoleon

    Sugar Master

  • Members
  • PipPipPip
  • 30 posts

Posted 21 December 2015 - 08:54 AM

Hi Supriyav,

 

To update a device using the URL you can try at the API Console the PUT petition to update a device, but you need all the information to update it. I recommend that you do a GET petition of the device to have the information and do a PUT of them changing the temperature property by the updated value of the last stream.

 

Try it and tell me.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users