Debian 10 (32-bit) not returning json data from REST API

Debian 10 (32-bit) not returning json data from REST API

I'm using an 11 year old 32-bit mini-PC (ViewSonic) with Debian 10 installed and no matter what I try, I can't get data from the following REST API. I have tried using curl and wget, but they always return no results. However, on my Win 10 machine, I get results every time.

wget https://opensky-network.org/api/states/all?lamin=51.8&lomin=-4.8&lamax=52.92&lomax=2.0

I suspect it's a hardware issue as I previously had Windows XP on the machine and that didn't work either using FreePascal and (separately) .NET 3.5 using C#. I tried installing Windows 10 (bloatware) on it yesterday, but it ran so slowly I gave up and installed Debian.

It's been a real headscratcher this past couple of days. Any suggestions would be appreciated!

Cheers Pete

答案1

You need to put the URL in quotes because it contains the & character. E.g.,

$ curl "https://opensky-network.org/api/states/all?lamin=51.8&lomin=-4.8&lamax=52.92&lomax=2.0" 
{"time":1605817730,"states":[["471f2e","WZZ4466 ","Hungary",1605817729,1605817729,1.0542,51.9321,4518.66,false,151.99,289.78,-4.88,null,4617.72,"7547",false,0],["4400be","TAY4014 ","Austria",1605817729,1605817729,-1.0094,52.8492,1028.7,false,110.36,184.01,-5.85,null,null,"4215",false,0],["a3e69d","UPS207  ","United States",1605817729,1605817729,-0.698,52.1777,4472.94,false,220.59,129.89,-9.1,null,4579.62,"7666",false,0],["45ce4e","SRR6977 ","Denmark",1605817728,1605817728,-1.3139,52.8313,-83.82,false,58.15,268.48,-0.65,null,144.78,"0504",false,0],["48c22e","RYR7MH  ","Poland",1605817729,1605817729,1.5407,52.9022,11887.2,false,253.58,100.28,0,null,11887.2,"2264",false,0]]}

Without quotes, the & causes your shell to split that string into multiple commands, and you end up fetching a partial URL (everything up to the first &: https://opensky-network.org/api/states/all?lamin=51.8).

相关内容