Jump to content









Photo

Trigger variables

trigger

  • Please log in to reply
4 replies to this topic

#1 chileM2M

chileM2M

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 20 February 2013 - 04:53 PM

Hello.

 

I've managed to send streams to Carriots and everything is going fine. Now I need to send the data received to an external DB. I've published a PHP script that may receive data sent in a POST request but I don't know how to write the payload to put my stream data in it.

 

My trigger configuration is:

  • Max retries: 10
  • Push frequency: 0
  • URL: http://mydomain/carriots.php
  • Verb: POST
  • Headers:
  • Parameters: Valor=data[Valor]
  • Payload: Valor=data[Valor]
  • User/Pass:

 

In my log file I see that Carriots connects to my script, but no data is associated to "Valor" variable. I send data stream like:

 

{
  "at": 1361378653,
  "protocol": "v2",
  "device": "defaultDevice@chileM2M",
  "data": {
    "Valor":719
  }
}

 

Please tell me how to configure the trigger.

 

Thanks.

 

 



#2 jpastor

jpastor

    Development leader

  • Administrators
  • 159 posts

Posted 20 February 2013 - 06:16 PM

Hello friend



If you want to rescue a field of data, you have to type the name between %%%.

In your case, you have to replace in Payload:

Valor=data[Valor] by Valor=%%%Valor%%%



If you have any other question, please use this forum or our support email.

Hope it helps!

Enjoy Carriots



#3 chileM2M

chileM2M

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 20 February 2013 - 06:51 PM

Thank you jpastor, but I didn't receive any data yet.

 

I'm using PHP and I use $_POST['Valor'] without getting anything...

 

Should I use another way to retrieve the data? Must I keep the parameters and the payload?



#4 jpastor

jpastor

    Development leader

  • Administrators
  • 159 posts

Posted 20 February 2013 - 07:19 PM

Hello friend



- If you are using $_POST, you have to specify the correct header. In your case try with this in the Headers field:

Content-type : application/x-www-form-urlencoded


- Respect to the parameters, it's not necessary to specify in the POST request



Hope it helps!

Enjoy Carriots



#5 chileM2M

chileM2M

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 21 February 2013 - 03:50 PM

With that header all works fine. Thanks!







Also tagged with one or more of these keywords: trigger

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users