Post data to my Thingspeak channel using telnet | ThingSpeak Projects | 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
Post data to my Thingspeak channel using telnet
No permission to create posts
September 25, 2014
11:02 pm
Avatar
mdce4
New Member
Members
Forum Posts: 2
Member Since:
September 25, 2014
sp_UserOfflineSmall Offline

Is it possible? I'm using telnet on a raspberry pi from the command line, trying to update to my thingspeak channel.
Here is what I did. it gave me a 200 OK response, but no data shows up on my Thingspeak channel:

sudo telnet api.thingspeak.com 80

POST /update HTTP/1.1
Host:api.thingspeak.com
Connection: close
X-THINGSPEAKAPIKEY:2ENL8UUKM3T82Y8J
Content-Type: application/x-www-form-urlencoded
Content-Length:10

field1=241

This is the response i get:

HTTP/1.1 200 OK
Server: nginx/1.7.5
Date: Fri, 26 Sep 2014 02:54:26 GMT
Content-Type: text/html; charset=utf-8
Transfer-Encoding: chunked
Connection: close
Vary: Accept-Encoding
Status: 200 OK
X-Frame-Options: ALLOWALL
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST, PUT, OPTIONS, DELETE, PATCH
Access-Control-Allow-Headers: origin, content-type, X-Requested-With
Access-Control-Max-Age: 1800
ETag: "9bf31c7ff062936a96d3c8bd1f8f2ff3"
Cache-Control: max-age=0, private, must-revalidate
Set-Cookie: request_method=POST; path=/
X-Request-Id: 1b8d5b3b-325e-43df-832a-2fc034561428

2
15
0

Connection closed by foreign host.

After this, i check my Thingspeak channel, but nothing ever shows up there.

September 26, 2014
12:41 pm
Avatar
lee

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

Hi,

It looks like your request to ThingSpeak is valid, but the POST data is not being set correctly for field1. I'm not sure how to send the request directly through telnet, but you may have more success using a GET instead of a POST.

You can see the blank values in your Channel here: https://thingspeak.com/channels/14918/feed.json?key=2ENL8UUKM3T82Y8J .

lee

September 28, 2014
1:12 pm
Avatar
mdce4
New Member
Members
Forum Posts: 2
Member Since:
September 25, 2014
sp_UserOfflineSmall Offline

Hi lee,
I had to end up using wireshark to look at the packets that were going out after I did the telnet. It ended up being an extra space in between the content-length and the field data, so the POST data was not being sent correctly. I corrected that and it works now.
thanks for the help

Forum Timezone: America/New_York

Most Users Ever Online: 114

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

BarryMaync, ThomasRougs, DonaldGen, prince, JrGordon, Elamsweems

Administrators: Hans: 387, lee: 457