ThingHTTP POST to PushingBox - pass value fields | ThingSpeak API | Forum

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

Register Lost password?
sp_Feed sp_TopicIcon
ThingHTTP POST to PushingBox - pass value fields
Avatar
mojthingspeakforum
New Member
Forum Posts: 3
sp_UserOfflineSmall Offline
1
October 30, 2015 - 1:33 pm
sp_Permalink sp_Print sp_EditHistory

Hi,

I am trying to send my last data from my channel fields to my PushingBox scenario. I want to pass my fresh data from my fields.
On the PushingBox side i have set up few variables in my body message: "$variable_1$, $variable_2$, $variable_3$"

On my ThingSpeak side i have set up ThingHTTP with this:

URL: "http://api.pushingbox.com/pushingbox?devid=[MY PUSHINGBOX DEVICE ID]"
HTTP Auth Username: [MY PUSHINGBOX DEVICE ID]
HTTP Auth Password:
Method: POST
Content Type: application/json
HTTP Version:1.1
Host: api.pushingbox.com
-----------------------------------------

I tried this:
1)
URL: http://api.pushingbox.com/pushingbox?devid=%5BMY PUSHINGBOX DEVICE ID]&variable_1="TEST-1"&variable_2="TEST-2"&variable_3="TEST-3"
This works and i got notifications with these values. But what i want is not static data but data from my channel fields! So instead of "TEST-1" i want to have field_1 data and "TEST-2" i want to have field_2, etc.

Probably it has something to do with "Channel Value Replacements"
%%channel_CHANNEL_ID_field_FIELD_NUMBER%%

So my URL should look like something like this(but it doesn't work):
URL: http://api.pushingbox.com/pushingbox?devid=%5BMY PUSHINGBOX DEVICE ID]&variable_1=channel_[MY CHANNEL ID]_field_1%% &variable_2=channel_[MY CHANNEL ID]_field_1%%&variable_3=channel_[MY CHANNEL ID]_field_1%%

But how to use it, could u give me an example.
Should i append it in my URL or my body field, where exactly ... example please.
Am i missing something?

help

Avatar
rw950431

Forum Posts: 252
sp_UserOfflineSmall Offline
2
October 31, 2015 - 7:21 am
sp_Permalink sp_Print

Maybe your second URL is missing the %% at the start of the variable -try

URL: http://api.pushingbox.com/pushingbox?devid=MY PUSHINGBOX DEVICE ID]&variable_1=%%channel_[MY CHANNEL ID]_field_1%% &variable_2=%%channel_[MY CHANNEL ID]_field_1%%&variable_3=channel_[MY CHANNEL ID]_field_1%%

If you include all the info in the parameters you probably can change

Method: POST
to
Method: GET

Avatar
mojthingspeakforum
New Member
Forum Posts: 3
sp_UserOfflineSmall Offline
3
October 31, 2015 - 9:57 am
sp_Permalink sp_Print

Hey,

i have tried both:
1) http://api.pushingbox.com/pushingbox?devid=XXXXXXXXXXXXXXXXXXX&room=livingroom&temperature=%%channel_XXXXXXX_field_1%%&humidity=%%channel_XXXXXX_field_2%%

2) Post and Get. I have changed from POST to GET but without result. Could u give me an example of changing info in parameters?

Avatar
rw950431

Forum Posts: 252
sp_UserOfflineSmall Offline
4
November 1, 2015 - 4:19 am
sp_Permalink sp_Print

Does pushingbox have a way to view incoming requests?

If not perhaps you can set up a url at http://requestb.in/ (click on create) then send your requests to there instead

eg (the 14j2... string will be different for yours)

http://requestb.in/14j2jw91?devid=XXXXXXXXXXXXXXXXXXX&room=livingroom&temperature=%%channel_XXXXXXX_field_1%%&humidity=%%channel_XXXXXX_field_2%%

The website will display what your program is sending to it and allow you to make changes. Perhaps thingspeak variable substitution doesnt work in the URL parameters... If so you may have to put the data in the body and go back to POST.

Avatar
mojthingspeakforum
New Member
Forum Posts: 3
sp_UserOfflineSmall Offline
5
November 1, 2015 - 2:39 pm
sp_Permalink sp_Print

It works! THANK YOU!

😀

I used requestb.in for testing.

Changes:
URL: http://api.pushingbox.com/pushingbox?devid=XXXXXXXXXXXXXXXX
Method: POST
Content Type: application/x-www-form-urlencoded
Body: room=livingroom&temperature=%%channel_XXXXXXXX_field_1%%&humidity=%%channel_XXXXXXXX_field_2%%

result is something like this: ....temperature=33.000001200456&humidity=46.00045660045

now i need to limit-format decimals to look something like this"0.00" I know that i can do it from arduino side but what about thingspeak side.
format --> %%channel_XXXXXXXX_field_1%%

Avatar
rw950431

Forum Posts: 252
sp_UserOfflineSmall Offline
6
November 1, 2015 - 11:31 pm
sp_Permalink sp_Print

So you confirmed that variable substitution DIDNT happen in the URL parameters? Thats useful information to know.

I suspect there's not much control over the formatting during variable substitution- if you want more control then maybe you have to use a matlab analysis app with the webwrite function.

Avatar
electronicsguy
New Member
Forum Posts: 1
sp_UserOfflineSmall Offline
7
January 4, 2016 - 3:08 pm
sp_Permalink sp_Print

@mojthingspeakforum - were you able to get it working with pushingbox?

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
28 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

candacele1

WilliamBer

roxieob18

Metawatch

ozayagw

ubabeutiti

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee