nasa / nasa/api-docs

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

Open
#174 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SCSS
Stars
555
Forks
140
Avg merge
2h 30m
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the Windows curl request and compare the transmitted URL with the request handling in flaskproject/app.py lines 261-276. Determine whether the query parameters are being dropped by the API or an external proxy, then document the cause and confirm the appropriate repository for the fix.

Written by the indexing model from the issue text.

Assessment

Tech stack
flask, python
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.