How to get json data from ThingHTTP API | ThingSpeak Apps | 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
How to get json data from ThingHTTP API
Avatar
lelopa
New Member
Forum Posts: 1
sp_UserOfflineSmall Offline
1
January 29, 2018 - 12:44 pm
sp_Permalink sp_Print

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

Avatar
cstapels
Moderator
Forum Posts: 158
sp_UserOfflineSmall Offline
2
January 31, 2018 - 9:38 am
sp_Permalink sp_Print

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:
36 Guest(s)

Currently Browsing this Page:
2 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

ibgedubo

aogomaeqaza

ureomug

itixuwidouzuv

eilimir

memozupi

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee