Giter Site home page Giter Site logo

Comments (18)

Huc91 avatar Huc91 commented on August 24, 2024 1

https://api.nasa.gov/planetary/apod/direct?[insert API key here]

Returns Error 500

from api-docs.

Fieel avatar Fieel commented on August 24, 2024 1

Yup same error here. I thought this problem was solved years ago?

https://api.nasa.gov/planetary/apod/direct?date=2015-06-03&api_key=DEMO_KEY

returns

{ "code": 500, "msg": "Sorry, unexpected error: must be str, not NotFound", "service_version": "v1" }

from api-docs.

Huc91 avatar Huc91 commented on August 24, 2024 1

Yep, I don't know if it's a temporary problem because I stared using the API just a few days ago but it always returns:
{ "code": 500, "msg": "Sorry, unexpected error: must be str, not NotFound", "service_version": "v1" }
It would be very nice to have (again) CORS enabled images :-)

from api-docs.

knynkwl avatar knynkwl commented on August 24, 2024

+1

from api-docs.

danhammer avatar danhammer commented on August 24, 2024

thanks. I will work on this really soon -- this week?! thanks for the note.

from api-docs.

AdamMurray avatar AdamMurray commented on August 24, 2024

+1

I would also really love to avoid jsonp

from api-docs.

wnodom avatar wnodom commented on August 24, 2024

+1

CORS support would definitely be appreciated.

from api-docs.

quicoto avatar quicoto commented on August 24, 2024

+1

from api-docs.

danhammer avatar danhammer commented on August 24, 2024

Thanks so much for the issues. I am slowly working my way through them. CORS support is now supported for the APOD API. (I will now move on to the Landsat API to address #39.) And I'll close this issue, once I update the documentation.

There is also a new endpoint to allow CORS support for the image itself, rather than just the JSON response. So, check it out:

QUERY:

https://api.nasa.gov/planetary/apod?date=2015-06-03&api_key=DEMO_KEY

RESONSE:

{
  "url": "http://apod.nasa.gov/apod/image/1506/hyperion02_cassini_960.jpg",
  "media_type": "image", 
  "explanation": "Why does this moon look like a sponge? To better investigate, NASA and ESA sent the Saturn-orbiting robotic spacecraft Cassini zooming past Saturn's moon Hyperion, once again, earlier this week.  One of the images beamed back to Earth is featured above, raw and unprocessed. Visible, as expected, are many unusually shaped craters with an unusual dark material at the bottom.  Although Hyperion spans about 250 kilometers, its small gravitational tug on Cassini indicates that it is mostly empty space and so has very low surface gravity.  Therefore, the odd shapes of many of Hyperion's craters are thought to result from impacts that primarily compress and eject surface material -- instead of the more typical round craters that appear after a circular shock wave that explosively redistributes surface material. Cassini is on track for another flyby of Saturn's Dione in about two weeks.   Retrospective: All Previous June 3 APODs",
  "concepts": null,
  "title": "Flyby Image of Saturns Sponge Moon Hyperion"
}

HEADERS:

accept-ranges:bytes
access-control-allow-origin:*
age:0
alternate-protocol:80:quic,p=0
cache-control:no-cache
Connection:keep-alive
content-encoding:gzip
Content-Length:662
Content-Type:application/json
Date:Wed, 03 Jun 2015 16:24:45 GMT
Server:nginx
vary:Accept-Encoding, Accept-Encoding
via:1.1 varnish-v4
x-cache:MISS
X-RateLimit-Limit:30
X-RateLimit-Remaining:24
x-varnish:15443927

If you want the image directly with CORS support, hit this new endpoint:

QUERY:

https://api.nasa.gov/planetary/apod/direct?date=2015-06-03&api_key=DEMO_KEY

RESPONSE:

direct

HEADERS:

accept-ranges:bytes
access-control-allow-origin:*
age:0
alternate-protocol:80:quic,p=0
cache-control:no-cache
Connection:keep-alive
Content-Length:538966
Content-Type:image/png
Date:Wed, 03 Jun 2015 17:03:18 GMT
Server:nginx
via:1.1 varnish-v4
x-cache:MISS
X-RateLimit-Limit:30
X-RateLimit-Remaining:21
x-varnish:15195289

More generally, there is a lot to do. Caching, CI testing, etc. I will systematically address the issues; and then I am going to solicit help! The only reason why this isn't a totally open project is that there are internal credentials that I need to mask out before public release. After I do that, it would be awesome to have some help or code reviews!

from api-docs.

wnodom avatar wnodom commented on August 24, 2024

Thanks so much, Dan! Can't wait to give it a try.

from api-docs.

AdamMurray avatar AdamMurray commented on August 24, 2024

Great work Dan! Once I stop being an idiot at JS I'll be using this thoroughly

from api-docs.

benjaminboruff avatar benjaminboruff commented on August 24, 2024

Excellent! I was able to query/receive the APOD JSON string from my local test webserver that serves up an AngularJS test app. Sweet! I'm sure we will all help out with testing ... just light the beacons!

UPDATE - the direct endpoint also works ...
-Ben
Benjamin H Boruff
[email protected]
benjaminboruff.github.io

from api-docs.

danhammer avatar danhammer commented on August 24, 2024

awesome! thanks for the support @wnodom, @AdamMurray, and @benjaminboruff! I am progressively adding features, trying desperately not to change the structure of the response (just adding to it). The new Landsat endpoints are going to be sweet.

from api-docs.

brianthomas avatar brianthomas commented on August 24, 2024

Closing issue as it looks solved (and, I'll note that CORS is enabled in Flask APOD-API)

from api-docs.

Fieel avatar Fieel commented on August 24, 2024

@Huc91 i just created a new issue, feel free to report there

from api-docs.

jasonduley avatar jasonduley commented on August 24, 2024

please try again

from api-docs.

Fieel avatar Fieel commented on August 24, 2024

@jasonduley as stated in #99 (comment) the "direct" url is broken so i just used the normal URL and it's working. People (like me) might find this thread and waste a lot of time trying to use the 'direct' URL though.

from api-docs.

amygoodchild avatar amygoodchild commented on August 24, 2024

I'm having the same issue. The direct URL is broken and the other one doesn't allow me to use the image url in my code due to a CORS error. Any chance of getting this looked again? Thanks so much!

from api-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.