Unfortunately, this does not work either. Since I had this working in HTML, so I open the Chrome “Inspect Element” to view the Request Header. it is same as I type in. I even cut and paste everything Chrome has send out but return same error number.
So this must be the PuTTY setting. I am using following
OK so you are trying to use telnet over PuTTY as a web browser? The Spark API is always HTTPS so I think the moved permanently refers to moving to HTTPS.
You need to change to port 443 and use SSL. Plus the GET request does not always include the host name and requires a version tag, and you likely need a separate host: line.
GET v1/devices/53…87/systemState?access_token=09…1b HTTP/1.1
Host: api.spark.io
<>
Now, I just download the curl and use the command data as in Spark doc. It is working.
However, I still don’t know what had I done wrong in PuTTY in term of configuration.
Or may be PuTTY does not support SSL ??
I am using this for getting UART debug for the core and it is easy to use.
PuTTY does support SSL, but the format of a HTTP or HTTPS request is not just one line but many lines typically. HTTPS with SSL runs on port 443 not port 80 like you where using. You can see this by passing the -v flag to your curl request to see all the things it is doing.
So while it is possible to use PuTTY to do HTTPS requests, curl is a whole lot easier.
I do get the Spark.variable to work though. I tried to create the .bat file in DOS. It had been a long time last edit batch.
Tried using the ^ to wrap the line but did not work.
Just to do everything is single line and not working neither.
So “brew” is a sample function name in the docs, for Tinker the function names are digitalread, digitalwrite, analogread, analogwrite. These always take a string and a return an int and go at the end of the API URL.
Curl automatically does a POST request if you pass args with the -d flag so that works great for Spark functions but not for Spark variables where you want a GET request.
Thanks for all the hints and suggestions. Now I can move on again
It over 10 years since I last edit a batch file in project ..... Sound like an "old man"