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

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





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

sp_Feed sp_TopicIcon
ThingHTTP POST to PushingBox - pass value fields
No permission to create posts
October 30, 2015
1:33 pm
Avatar
mojthingspeakforum
New Member
Members
Forum Posts: 3
Member Since:
October 30, 2015
sp_UserOfflineSmall Offline

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

October 31, 2015
7:21 am
Avatar
rw950431

Top
Members
Forum Posts: 262
Member Since:
January 30, 2014
sp_UserOfflineSmall Offline

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

October 31, 2015
9:57 am
Avatar
mojthingspeakforum
New Member
Members
Forum Posts: 3
Member Since:
October 30, 2015
sp_UserOfflineSmall Offline

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?

November 1, 2015
4:19 am
Avatar
rw950431

Top
Members
Forum Posts: 262
Member Since:
January 30, 2014
sp_UserOfflineSmall Offline

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.

November 1, 2015
2:39 pm
Avatar
mojthingspeakforum
New Member
Members
Forum Posts: 3
Member Since:
October 30, 2015
sp_UserOfflineSmall Offline

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

November 1, 2015
11:31 pm
Avatar
rw950431

Top
Members
Forum Posts: 262
Member Since:
January 30, 2014
sp_UserOfflineSmall Offline

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.

January 4, 2016
3:08 pm
Avatar
electronicsguy
New Member
Members
Forum Posts: 1
Member Since:
January 4, 2016
sp_UserOfflineSmall Offline

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

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
22 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

BarryMaync, ThomasRougs, DonaldGen, prince, JrGordon, Elamsweems

Administrators: Hans: 387, lee: 457