Response field:null | 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
Response field:null
No permission to create posts
July 3, 2020
12:58 pm
Avatar
mumusse
New Member
Members
Forum Posts: 2
Member Since:
July 3, 2020
sp_UserOfflineSmall Offline

Good morning to all.
I apologize for my bad English, I have translated with Google.
I am using the REST API in a project, in which I have an ESP8266 that performs measurements and sends them to two fields of a Thingspeak channel, and an apk that allows me to send data to that ESP8266 to set the time of a timer using two fields of the channel .
It happens that when writing a single field of the 4 of the channel, reading the channel info (from the link https://api.thingspeak.com/channels/ /feeds.json) returns only the real value of the last field updated and the others with a value of "null".
Example:

Write Channel: https://api.thingspeak.com/update?api_key=5SO213O2UFAIAYIQ&field1=10&field2=20&field3=30&field4=40
Response: 4
Read feed: https://api.thingspeak.com/channels/1093470/feeds.json?results=2
Response:
{"channel":{"id":1093470,"name":"Canal 4-Pruebas-2","latitude":"0.0","longitude":"0.0","field1":"Field Label 1","field2":"Field Label 2","field3":"Field Label 3","field4":"Field Label 4","created_at":"2020-07-03T15:25:32Z","updated_at":"2020-07-03T16:26:15Z","last_entry_id":7},"feeds":[{"created_at":"2020-07-03T16:31:30Z","entry_id":6,"field1":"15","field2":null,"field3":null,"field4":null},{"created_at":"2020-07-03T16:33:04Z","entry_id":7,"field1":"10","field2":"20","field3":"30","field4":"40"}]}

Write only field 1: https://api.thingspeak.com/update?api_key=5SO213O2UFAIAYIQ&field1=15&field2=25
Response: 5
Read feed: https://api.thingspeak.com/channels/1093470/feeds.json?results=2
Response:
{"channel":{"id":1093470,"name":"Canal 4-Pruebas-2","latitude":"0.0","longitude":"0.0","field1":"Field Label 1","field2":"Field Label 2","field3":"Field Label 3","field4":"Field Label 4","created_at":"2020-07-03T15:25:32Z","updated_at":"2020-07-03T16:26:15Z","last_entry_id":6},"feeds":[{"created_at":"2020-07-03T16:30:06Z","entry_id":5,"field1":"15","field2":25,"field3":null,"field4":null},{"created_at":"2020-07-03T16:31:30Z","entry_id":6,"field1":"15","field2":25,"field3":null,"field4":null}]}

Is there a way to update fields independently, so that when retrieving a Feed the values of the other fields are obtained ( no "null"?

Thanks for your time and attention.

July 10, 2020
8:58 am
Avatar
cstapels
Moderator
Members


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

A channel feed (all the fields) does not act independently. The best way to get the behavior you want is to use multiple channels.

That said, you can read the last entry in a field to get what you are looking for. See Read Last Field Entry for the correct syntax.

FYI, MATLAB answers is the preferred location for ThingSpeak Community support.

July 15, 2020
5:34 pm
Avatar
mumusse
New Member
Members
Forum Posts: 2
Member Since:
July 3, 2020
sp_UserOfflineSmall Offline

K thank you very much.

Forum Timezone: America/New_York

Most Users Ever Online: 166

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

vaisakh, EVISSER, vegartb, gurunath, nulogic, eduloans

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457