Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : Panic calling an API
Author | Message | ||||
pwillard Senior Member Joined: 07/06/2022 Location: United StatesPosts: 292 |
ntp address 132.163.97.3 got ntp response: 19/09/2023 16:05:11 16:05:11 GMT Rest Call = GET /maps/api/timezone/json?location=34.2073%2C-84.1402&timstamp=1695139511&key=<my google API key> *** PANIC *** Out of memory Port: COM13 removed Disconnected I'm making an API call similar to the OPENWEATHER call, except this is the first time I've been forced to use TLS. Apparently, I've done it wrong. Is anyone else calling this GOOGLE API? Hints? |
||||
Mixtel90 Guru Joined: 05/10/2019 Location: United KingdomPosts: 6798 |
Those APIs can be very sensitive little souls. You have to be very careful what you call them or they can get very sulky indeed, and some will panic if called abruptly! OTOH I've been known to call Google all sorts of things... ;) Mick Zilog Inside! nascom.info for Nascom & Gemini Preliminary MMBasic docs & my PCB designs |
||||
JohnS Guru Joined: 18/11/2011 Location: United KingdomPosts: 3802 |
I suspect it depends which thing is creating the PANIC & Out of memory messages. If it's the Pico it may be that it's receiving something it can't handle - too long or complex or some such. John |
||||
pwillard Senior Member Joined: 07/06/2022 Location: United StatesPosts: 292 |
Well, the response when I do it using a "tool" (advanced Rest Client) shows this is the response: { "dstOffset": 3600, "rawOffset": -18000, "status": "OK", "timeZoneId": "America/New_York", "timeZoneName": "Eastern Daylight Time" } ... but other than changing the code to use TLS instead of TCP, it's nearly identical to openweather API example. Basically, I have the URL defined as dim URL$ = "https://maps.googleapis.com" The Request as : DIM REQUEST$ = "GET /maps/api/timezone/json" And then I append the particulars... like location(lat Lon), Timestamp and my API key into a string called RESTCALL$. WEB open TLS client URL$,443 WEB TLS CLIENT REQUEST RESTCALL$,buff%(),10000 WEB CLOSE TLS CLIENT Apparently, the PANIC is from this line of code: WEB open TLS client URL$,443 Edited 2023-09-20 02:57 by pwillard |
||||
pwillard Senior Member Joined: 07/06/2022 Location: United StatesPosts: 292 |
In fact, all I need to do to create the *** PANIC *** is a program that looks like this (and nothing else): WEB open tls client "https://maps.googleapis.com",443 WEB close tls client |
||||
matherp Guru Joined: 11/12/2012 Location: United KingdomPosts: 9124 |
There are only a limited number of encryption algorithms supported by lwip. Sounds like you have found one that isn't supported. Also many TLS sites use SSL over TLS and this isn't supported at all |
||||
pwillard Senior Member Joined: 07/06/2022 Location: United StatesPosts: 292 |
Bummer, It looked like a handy API... and my first attempt at TLS... Will try http://worldtimeapi.org/ instead, which is what already I *was* using... Edited 2023-09-20 05:03 by pwillard |
||||
carlschneider Senior Member Joined: 04/08/2023 Location: South AfricaPosts: 158 |
Never tried API and TLS before but isn’t this missing the HTTP1.1 piece of the header on the end and all the /r/n's to separate the headers? Cheers Carl Retirement is tough on Hobbies without a day job |
||||
Print this page |