JSONP response for update? | ThingSpeak API | Forum

The ThingSpeak community site has been upgraded to a new site. This site is currently in read-only mode. You can ask questions or post and read discussions on the new site.
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
JSONP response for update?
No permission to create posts
February 25, 2013
2:33 pm
Avatar
sekjal
New Member
Members
Forum Posts: 1
Member Since:
February 25, 2013
sp_UserOfflineSmall Offline

I'm creating a generic web form with jQuery Mobile that will allow users to manually post values to a Thingspeak channel provided they know the URL of the installation and the channel's write key. I've got a working prototype, but I'm having a little trouble making the posting AJAXy. Since the chances are strong that the Thingspeak install will be in a different domain than the web form, AJAX will not load the response to the update POST (which is just the ID of the newly created data entry)

If the response to an update were optionally wrapped in a callback (if one is provided), then the returned ID number could be seen as an integer, and processed via AJAX. Does this kind of addition make sense to folks, or would it get in the way of the primary intended clients (things)?

February 21, 2014
11:49 am
Avatar
tamberg
New Member
Members
Forum Posts: 1
Member Since:
February 21, 2014
sp_UserOfflineSmall Offline

+1 for JSONP

February 21, 2014
1:25 pm
Avatar
Hans
Natick, MA

Admin
Forum Posts: 411
Member Since:
January 18, 2011
sp_UserOfflineSmall Offline

Whoops, looks like we missed an old forum topic. But, JSONP was and is support since day 1 of ThingSpeak.

Every API command can include a "callback" parameter. What ever value gets sent, will be wrapped around the response.

Here's an example:

http://api.thingspeak.com/channels/3/feed/last.json?callback=testFunction

Response:

testFunction({"created_at":"2014-02-21T18:15:42Z","entry_id":162936,"field1":"60.6 F"})

I hope that helps!

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
31 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 272

Vinod: 240

piajola: 95

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 8665

Moderators: 1

Admins: 2

Forum Stats:

Groups: 3

Forums: 14

Topics: 1600

Posts: 5760

Newest Members:

tran, huldacormier, bogart, estebanmateo93, mikewrite, onlinebusiness

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457