Parse Thingspeak data with ThingHTTP | ThingSpeak Apps | 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
Parse Thingspeak data with ThingHTTP
No permission to create posts
May 3, 2011
12:53 pm
Avatar
H07R0D

Silver
Members
Forum Posts: 8
Member Since:
April 22, 2011
sp_UserOfflineSmall Offline

I'm looking to send some data up from a Netduino, and also back down to it.

Ideally, I'd like to send down field names as listed in the channel.  Can I use ThingHTTP to parse a feed.json from Thingspeak and send down just the field name string?

May 3, 2011
1:05 pm
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

Yes this will work, try the following as an example.

URL: http://api.thingspeak.com/channels/9/feed.xml?results=0

parse: field1

May 3, 2011
1:28 pm
Avatar
H07R0D

Silver
Members
Forum Posts: 8
Member Since:
April 22, 2011
sp_UserOfflineSmall Offline

lee said:

Yes this will work, try the following as an example.

URL: http://api.thingspeak.com/channels/9/feed.xml?results=0

parse: field1

Thanks, I was just getting into that section.  XPath is pretty new to me, how would I return all fields instead just field1?

 

edit: Just noticed the gravatar, I guess I should start being a dick now right? Wink

May 3, 2011
1:54 pm
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

Try using this parse string:

/channel/field1 | /channel/field2

May 5, 2011
8:28 am
Avatar
H07R0D

Silver
Members
Forum Posts: 8
Member Since:
April 22, 2011
sp_UserOfflineSmall Offline

That works just fine.

I did end up getting just the field names by using:
/channel/*[substring(name(),1, 5) = 'field']

Can I also send a style sheet in  my request?  I'd like to format the output a bit to show:

<1>Temperature</1><2>pH</2>

Is that doable with the parse string, or can I add something to the body?

May 5, 2011
8:53 am
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

There are 2 fields (prepend and append) that will allow you to format the output, but they only allow you to format it at the beginning and the end, so you could do each request separately:

http://api.thingspeak.com/apps/thinghttp/send_request?api_key=YOUR_API_KEY&prepend=<1>&append=</1&gt;

 

http://api.thingspeak.com/apps/thinghttp/send_request?api_key=YOUR_SECOND_API_KEY&prepend=<2>&append=</2&gt;

 

If you want this all as one request, you'll have to format the response on your end somehow, maybe by using:

parse string: /channel/field1 | /channel/field2

which should return: <field1>Temperature</field1><field2>pH</field2>

and then removing all strings of "field".

 

Edit: the &gt; in the urls should be replaced by >, I can't get this forum to post it correctly.

March 13, 2013
5:41 am
Avatar
Deepak
New Member
Members
Forum Posts: 3
Member Since:
March 7, 2013
sp_UserOfflineSmall Offline

lee said

Yes this will work, try the following as an example.

URL: http://api.thingspeak.com/channels/9/feed.xml?results=0

parse: field1

it works for getting field name.. what parse string to be used to get value at that field.?

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

GenriWat, augustarp2, eduardohr18, Rufusdok, nellievd4, susannaab1

Administrators: Hans: 387, lee: 457