nasa / api-docs

api.nasa.gov
http://nasa.github.io/api-docs/
429 stars 106 forks source link

Earth API Returning 403 (due to query parameters being dropped) #174

Open mosheduminer opened 1 year ago

mosheduminer commented 1 year ago

Curl shows the following:

> curl -vvv https://api.nasa.gov/planetary/earth/imagery?lon=-95.33&lat=29.78&date=2018-01-01&dim=0.15&api_key=DEMO_KEY
*   Trying 3.32.45.174:443...
* Connected to api.nasa.gov (3.32.45.174) port 443 (#0)
* schannel: disabled automatic use of client certificate
* ALPN: offers http/1.1
* ALPN: server accepted http/1.1
> GET /planetary/earth/imagery?lon=-95.33 HTTP/1.1
> Host: api.nasa.gov
> User-Agent: curl/7.83.1
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 403 Forbidden
< Date: Sun, 18 Sep 2022 13:11:00 GMT
< Content-Type: application/json
< Transfer-Encoding: chunked
< Connection: keep-alive
< Vary: Accept-Encoding
< Access-Control-Allow-Origin: *
< Strict-Transport-Security: max-age=31536000; preload
< Vary: Accept-Encoding
< X-Cache: MISS
< X-Content-Type-Options: nosniff
< X-Vcap-Request-Id: d9ceac37-96aa-4406-4396-26ea7faf305c
< X-Xss-Protection: 1; mode=block
< X-Frame-Options: DENY
<
{
  "error": {
    "code": "API_KEY_MISSING",
    "message": "No api_key was supplied. Get one at https://api.nasa.gov:443"
  }
}* Connection #0 to host api.nasa.gov left intact
'lat' is not recognized as an internal or external command,
operable program or batch file.
The system cannot accept the date entered.
Enter the new date: (mm-dd-yy)

Note this line: > GET /planetary/earth/imagery?lon=-95.33 HTTP/1.1 - apparently all query params after the first are dropped. Putting the API key first results in the command hanging (because lon and lat get omitted). I also get the same behavior trying to use my personal API key. I suppose a misconfigured proxy is to blame, as the code for this endpoint looks fine.

I noticed this issue: https://github.com/nasa/earth-imagery-api/issues/1. Based on my observations above, I don't agree with the conclusion there that NASA shut down the API (after all, I am getting a (bad) response from the server).

Of course, if this is not the right place to file an issue, you can transfer it, or I can open an issue in the appropriate repo.

mosheduminer commented 1 year ago

I also noticed this issue just now, but I'm not sure that it's the same as this one: https://github.com/nasa/api-docs/issues/164.