Channel feeds coming through as "null" since adding 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
Channel feeds coming through as "null" since adding fields
No permission to create posts
February 5, 2018
7:49 pm
Avatar
BiologyWatcher
New Member
Members
Forum Posts: 2
Member Since:
February 5, 2018
sp_UserOfflineSmall Offline

I recently added 4 fields for a total of 6 and since then I can't seem to pinpoint a weird bug that only the latest updated value is returned on an API call under "feeds". However the graphs are working just fine and I can see the data is there. Here's a small snippet of .json from my channel:

{"channel":{"id":182539,"name":"Flower Room","description":"Collects Flower Room Data","latitude":"0.0","longitude":"0.0","field1":"Room Temperature","field2":"Room Humidity","field3":"Reservoir pH","field4":"Reservoir EC","field5":"Intensity at Canopy","field6":"Co2 Addition","created_at":"2016-11-12T23:30:52-07:00","updated_at":"2018-02-05T17:03:12-07:00","last_entry_id":453},"feeds":[{"created_at":"2018-02-05T16:21:27-07:00","entry_id":354,"field1":null,"field2":null,"field3":"5.91","field4":null,"field5":null,"field6":null},{"created_at":"2018-02-05T16:21:43-07:00","entry_id":355,"field1":null,"field2":null,"field3":null,"field4":"2.15","field5":null,"field6":null},{"created_at":"2018-02-05T16:21:59-07:00","entry_id":356,"field1":null,"field2":null,"field3":null,"field4":null,"field5":"13639.407","field6":null},{"created_at":"2018-02-05T16:22:16-07:00","entry_id":357,"field1":null,"field2":null,"field3":null,"field4":null,"field5":null,"field6":"1965.53"},{"created_at":"2018-02-05T16:23:01-07:00","entry_id":358,"field1":"26.23","field2":null,"field3":null,"field4":null,"field5":null,"field6":null},{"created_at":"2018-02-05T16:23:28-07:00","entry_id":359,"field1":null,"field2":null,"field3":"5.82","field4":null,"field5":null,"field6":null},{"created_at":"2018-02-05T16:23:44-07:00","entry_id":360,"field1":null,"field2":null,"field3":null,"field4":"2.12","field5":null,"field6":null},{"created_at":"2018-02-05T16:24:00-07:00","entry_id":361,"field1":null,"field2":null,"field3":null,"field4":null,"field5":"13560.425","field6":null},{"created_at":"2018-02-05T16:24:17-07:00","entry_id":362,"field1":null,"field2":null,"field3":null,"field4":null,"field5":null,"field6":"1958.65"},{"created_at":"2018-02-05T16:25:01-07:00","entry_id":363,"field1":"26.52","field2":null,"field3":null,"field4":null,"field5":null,"field6":null},

 

I've since deleted the channel and created a new one to no avail. As you can see, one value per API call. Any advice?

February 5, 2018
8:32 pm
Avatar
Vinod

MathWorks
Members
Forum Posts: 206
Member Since:
May 1, 2016
sp_UserOfflineSmall Offline

Based on the snippet, I think the issue is your code that is updating the channel is updating one field per update, instead of one update that updates all fields.

The most efficient code on your device would do a HTTP GET request like this:

https://api.thingspeak.com/update?api_key=YOUR_API_KEY_HERE&field1=10&field2=20&field3=30, etc. 

instead of 3 separate requests

https://api.thingspeak.com/update?api_key=YOUR_API_KEY_HERE&field1=10

https://api.thingspeak.com/update?api_key=YOUR_API_KEY_HERE&field2=20

https://api.thingspeak.com/update?api_key=YOUR_API_KEY_HERE&field3=30

February 5, 2018
9:37 pm
Avatar
BiologyWatcher
New Member
Members
Forum Posts: 2
Member Since:
February 5, 2018
sp_UserOfflineSmall Offline

Ohhhh! Yes. that's definitely it. Thanks for the quick response.

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