Fail to Update data to ThingSpeak by means of HTTP request in C | 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
Fail to Update data to ThingSpeak by means of HTTP request in C
No permission to create posts
April 28, 2016
2:26 am
Avatar
SukiYoon
New Member
Members
Forum Posts: 1
Member Since:
April 28, 2016
sp_UserOfflineSmall Offline

By referring to my output as shows below, the connection to thingspeak is success, but there's nothing uodate in my thingspeak channel that already in public.

Hope anyone can give some suggestion to solve it.

Thanks.

Below is my coding...

int main()
{
//cout << "Hello BeagleBone Black!

";
char waterLevel[60], flowRate[]="";
int i;

//First, need to run the program in /etc
//./ttyU.sh
//sudo wvdial; // this will put the modem into internet access mode

cout << "Hello Internet" << endl;

socket();
for(i=0;i<3;i++)
{

separateDataIntoMultipleStr(waterLevel, flowRate );
printf("Preparing sending to ThingSpeak...");

puts(waterLevel);
puts(flowRate);

system("wget http://api.thingspeak.com/update?key=IPB56DSWP8AQ5Y5I&field1=waterLevel&field2=flowRate");
sleep(20);
}

}

Below is my result:

root@arm:/home/ubuntu/Desktop# ./Beagle
Hello Internet
Setting up the structs...
Creating a socket...
Connect()ing...
send()ing message...
Waiting to receive data...
1000 bytes received :
HTTP/1.1 200 OK
Date: Thu, 28 Apr 2016 04:59:52 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
P3P: CP="This is not a P3P policy! See https://www.google.com/support/accounts/answer/151657?hl=en for more info."
Server: gws
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
Set-Cookie: NID=79=Y3WOnXyXG9Aq0m3X7mJLbyhvddvBVqrC2MOw8DnJdIgbMZTir-1Uw5xQD93rmm_Ob7RKg5reoBOu3t1-_iQEBrhbXreCdXddxIEiICegUOROOw-hGY4fgvqqcEZxbVC2bpjAte9bxzeJpn8; expires=Fri, 28-Oct-2016 04:59:52 GMT; path=/; domain=.google.com; HttpOnly
Accept-Ranges: none
Vary: Accept-Encoding
Transfer-Encoding: chunked

8000
<!doctype html><html itemscope="" itemtype="http://schema.org/WebPage" lang="en"><head><meta content="Search the world's information, including webpages, images, videos and more. Google has many special features to help you find exactly what you're looking for." name="description"><meta content="noodp" name="robots"><meta content="text/htm
Receiving complete. Closing socket...
Reading level and flow from file
level = 4.73 121.72

Preparing sending to ThingSpeak...4.73 121.72

--2016-04-28 12:59:52-- http://api.thingspeak.com/update?key=IPB56DSWP8AQ5Y5I
Resolving api.thingspeak.com (api.thingspeak.com)... 54.164.214.198, 54.88.155.198
Connecting to api.thingspeak.com (api.thingspeak.com)|54.164.214.198|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2 [text/html]
Saving to: ‘update?key=IPB56DSWP8AQ5Y5I.6’

100%[======================================================================================================>] 2 --.-K/s in 0.001s

2016-04-28 12:59:53 (2.08 KB/s) - ‘update?key=IPB56DSWP8AQ5Y5I.6’ saved [2/2]

Reading level and flow from file
level = 4.73 121.72

Preparing sending to ThingSpeak...4.73 121.72

--2016-04-28 13:00:12-- http://api.thingspeak.com/update?key=IPB56DSWP8AQ5Y5I
Resolving api.thingspeak.com (api.thingspeak.com)... 54.164.214.198, 54.88.155.198
Connecting to api.thingspeak.com (api.thingspeak.com)|54.164.214.198|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2 [text/html]
Saving to: ‘update?key=IPB56DSWP8AQ5Y5I.7’

100%[======================================================================================================>] 2 --.-K/s in 0s

2016-04-28 13:00:13 (9.84 KB/s) - ‘update?key=IPB56DSWP8AQ5Y5I.7’ saved [2/2]

Reading level and flow from file
level = 4.73 121.72

Preparing sending to ThingSpeak...4.73 121.72

--2016-04-28 13:00:32-- http://api.thingspeak.com/update?key=IPB56DSWP8AQ5Y5I
Resolving api.thingspeak.com (api.thingspeak.com)... 54.164.214.198, 54.88.155.198
Connecting to api.thingspeak.com (api.thingspeak.com)|54.164.214.198|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2 [text/html]
Saving to: ‘update?key=IPB56DSWP8AQ5Y5I.8’

100%[======================================================================================================>] 2 --.-K/s in 0s

2016-04-28 13:00:33 (10.1 KB/s) - ‘update?key=IPB56DSWP8AQ5Y5I.8’ saved [2/2]

June 20, 2016
9:05 am
Avatar
Hans
Natick, MA

Admin
Forum Posts: 402
Member Since:
January 18, 2011
sp_UserOfflineSmall Offline

Did you get this working? In your wget line, do you need to separate waterLevel and flowRate so that it writes the variable value versus the string?

August 25, 2018
7:58 am
Avatar
cxq638
New Member
Members
Forum Posts: 2
Member Since:
August 25, 2018
sp_UserOfflineSmall Offline

I also encounter the similar issue. My stat data is updated but I can't see data in field.

My Channel

Created: 11 days ago
Updated: 2 days ago
Last entry: 2 minutes ago
Entries: 17

The entries is updated but I can't see data in field4.
The cmd :
wget http://api.thingspeak.com/update?api_key=NBMF2HCFGBX1521B&field4=21

debian@beaglebone:~$ wget http://api.thingspeak.com/update?api_key=NBMF2HCFGBX1521B&field4=21
[1] 13760
debian@beaglebone:~$ --2015-03-04 09:15:53-- http://api.thingspeak.com/update?api_key=NBMF2HCFGBX1521B
Resolving api.thingspeak.com (api.thingspeak.com)... 34.202.98.102, 34.226.44.238, 2404:160:0:f:0:1:22ca:6266, ...
Connecting to api.thingspeak.com (api.thingspeak.com)|34.202.98.102|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2 [text/html]
Saving to: `update?api_key=NBMF2HCFGBX1521B.12'

100%[======================================>] 2 --.-K/s in 0s

2015-03-04 09:15:54 (25.4 KB/s) - `update?api_key=NBMF2HCFGBX1521B.12' saved [2/2]

September 10, 2018
10:33 am
Avatar
cstapels
Moderator
Members


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

There can be a short delay before the data appears on your thingSpeak plots. It is also possible that the auto scaling has rendered your data not visible. If you read the data in your channel (using a REST call, or the data export button or the data export table on your channel), do you see the data that you wrote?

September 11, 2018
3:00 am
Avatar
cxq638
New Member
Members
Forum Posts: 2
Member Since:
August 25, 2018
sp_UserOfflineSmall Offline

The data export as follow (Jason format):
created_at "2018-08-17T09:33:18Z"
entry_id 9
field4 null
9
created_at "2018-08-19T13:16:42Z"
entry_id 10
field4 null
10
created_at "2018-08-19T13:17:15Z"
entry_id 11
field4 null
11

Is that no data be uploaded to my channel- field 4?

September 12, 2018
10:10 am
Avatar
cstapels
Moderator
Members


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

Yes it appears that field 4 did not get updated. Are you using the write API key for your channel?
In your command above, the &field4=21 part is truncated the second time it appears. Is the buffer overflowing? In some interfaces, you need to send the URL and server name separately, though im not sure with wget on beaglebone.
Can you try pasting the url into a browser window and see if the channel is updated?

Forum Timezone: America/New_York

Most Users Ever Online: 114

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

AlienAboth, KeslarAboth, EnigmBioge, debbiepe18, MatthewmUb, cathrynww1

Administrators: Hans: 387, lee: 457