How to get json data from ThingHTTP API | 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
How to get json data from ThingHTTP API
No permission to create posts
January 29, 2018
12:44 pm
Avatar
lelopa
New Member
Members
Forum Posts: 1
Member Since:
January 29, 2018
sp_UserOfflineSmall Offline

Hi, I am new to Thingspeak and I am now struggling with the ThingHTTP. 

I am sending a http get request to receive data for my ESP8266. So far, everything is working perfectly well. My problem is that I need the data in the json format. Where can I specify, that thingspeak gives me a json format back to my get request? What do I have to type into the "Content Type:" field?

Thanks for your helpLaugh

January 31, 2018
9:38 am
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 258
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

Generally the HTTP requests end in the format you need (before the parameters).  Thingspeak supports JSON and XML for most endpoints.  Some of them also support TXT and CSV.

For example

https://api.thingspeak.com/channels/12345678910/feeds.json?api_key=XXXXXXXXXXXXXXXX&results=2 
will return 2 results from a private channel in JSON format.

https://api.thingspeak.com/channels/987654321/fields/6.xml?days=2&location=true
will return 2 days of results from field 6 of channel 987654321 (up to 8000 entries) and include location information, as long as the channel is public.

For GET requests, you do not need content type.  If you need to include that header, you can usually specify application/x-www-form-urlencoded unless you are using Bulk Update.

Have a look at the REST API documentation for more info.


Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online:
20 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:

terranceqh2, DianeEmids, Alanawaype, uqovitay, ufijifode, manish01

Administrators: Hans: 387, lee: 457