Jump to content









Photo

Use of "_t": "sta" and "_t":"str"

streams status api create

  • Please log in to reply
4 replies to this topic

#1 Zambiot

Zambiot

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts
  • LocationAsia

Posted 29 April 2013 - 09:35 AM

Carriots - 

 

In the Control Panel, when looking at streams or status, I see that Carriots adds an identify key/value of "_t":"str" to streams and "_t":"sta" to status.  I've also seen this used as an attribute as defined in the API for listing streams or status.  

 

Now, I wonder if perhaps I could use this same key/value in a Create Method on Streams to cause a Status  message to post.  That is, I've built the HTTP body for my status data, but put a "_t":"sta" in there as well and posted it to the http://api.carriots.com/streams/.  What happened is that the data was logged as a stream and not a status.  The "sta" was changed to a "str".  

 

Is this the desired behavior?  I think I could reduce my code footprint slightly if I posted all messages to streams, but built a different body based on if it is data or status.



#2 alvaro

alvaro

    Carriots CTO

  • Administrators
  • 72 posts

Posted 30 April 2013 - 07:12 AM

Hello Zambiot.

 

"_t" field is automatically set by Carriots dispatchers when they receive a stream. Status streams are marked with "_t":"sta" and data streams are marked with "_t":"str". You cannot change this field manually. 

 

HIH


Alvaro Everlet

Carriots CTO


#3 Zambiot

Zambiot

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts
  • LocationAsia

Posted 30 April 2013 - 07:16 AM

Could it be setup such that if that field is in the POST from the device that the Carriots Dispatcher doesn't change it and the information is logged per what the field says?  For instance, posting a body with "_t":"sta" to the /streams/ API instead of /status/ really logs the information as a status?



#4 alvaro

alvaro

    Carriots CTO

  • Administrators
  • 72 posts

Posted 30 April 2013 - 10:10 AM

Actually there are technical implications with that particular behavior and some future functionalities depend on it. I'm afraid that the only way to differentiate stream creation is by using /streams/ or /status/ in the URL.

 

HIH


Alvaro Everlet

Carriots CTO


#5 Zambiot

Zambiot

    Advanced Member

  • Members
  • PipPipPip
  • 94 posts
  • LocationAsia

Posted 30 April 2013 - 10:17 AM

OK.  I can make my code work, just slightly more effort, but overall, worth the pay off the future features you are working on.







Also tagged with one or more of these keywords: streams, status, api, create

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users