Can I update multiple channels with one POST? | 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
Can I update multiple channels with one POST?
No permission to create posts
June 16, 2013
1:47 am
Avatar
turgo

Gold
Members
Forum Posts: 77
Member Since:
June 16, 2013
sp_UserOfflineSmall Offline

Updating several ThingSpeak channels with the Arduino eats up lots of time. Can I update multiple channels with one POST?

December 3, 2013
6:21 pm
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

Hi,

Unfortunately the ability to update multiple channels with a single HTTP POST is not supported.

lee

December 7, 2013
10:24 pm
Avatar
grant77oksana
New Member
Members
Forum Posts: 3
Member Since:
December 7, 2013
sp_UserOfflineSmall Offline

I am trying to update only two channels and using two posts will work just fine for me but I can't get it to work. How do you use multiple posts? I am just putting one post after the other which I guess is wrong.

Thank you,

December 9, 2013
3:46 pm
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

If they are two different channels, then sending one POST after another should work. If they are on the same channel, you have to wait at least 15 seconds between each POST.

lee

December 9, 2013
9:40 pm
Avatar
grant77oksana
New Member
Members
Forum Posts: 3
Member Since:
December 7, 2013
sp_UserOfflineSmall Offline

Thank you... but I must be doing something wrong because it isn't working. Here is my code if you don't mind taking a look. The first post posts but the second does not. If I comment out the first then the second one posts without making any other changes. I have tried putting a delay between the two although you state that should not be necessary. Thank you very much for the help!

if (client.connect(server, 80)){

client.print("POST /update HTTP/1.1\n");
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
client.print("X-THINGSPEAKAPIKEY: "+writeAPIKey+"\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");
client.print(data.length());
client.print("\n\n");
client.print(data);
client.println();

client.print("POST /update HTTP/1.1\n");
client.print("Host: api.thingspeak.com\n");
client.print("Connection: close\n");
client.print("X-THINGSPEAKAPIKEY: "+writeAPIKey2+"\n");
client.print("Content-Type: application/x-www-form-urlencoded\n");
client.print("Content-Length: ");
client.print(data2.length());
client.print("\n\n");
client.print(data2);
client.println();
}

December 10, 2013
12:27 pm
Avatar
lee

Admin
Forum Posts: 457
Member Since:
March 14, 2011
sp_UserOfflineSmall Offline

Hi,

I'm not familiar with this programming language, but you may have to add the second POST in its own connection block by using client1 and client2, and using "client1.connect(server, 80)" and "client2.connect(server, 80)" separately.

lee

December 11, 2013
8:16 am
Avatar
grant77oksana
New Member
Members
Forum Posts: 3
Member Since:
December 7, 2013
sp_UserOfflineSmall Offline

If you are not very familiar with the code then that makes two of us! but your familiarity with coding in general seems to have solved my problem. it worked great! Thank you very much for the help!

Grant

Forum Timezone: America/New_York

Most Users Ever Online: 166

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