DEV Community

loading...

What free open API's do you use to demo code?

joelnet profile image JavaScript Joel ・1 min read

You are demoing some code. That code needs to hit an API... any API.

It's gotta be basic. Probably just an HTTP GET.

I found REQ | RES, which looks interesting. There's also The Cat API, which looks fun.

What do you reach for?

Discussion (14)

pic
Editor guide
Collapse
ben profile image
Collapse
joelnet profile image
JavaScript Joel Author

I decided to go with SWAPI. Here's the examoke I was creating: mojiscript.js.org/#/function-lift-p

This function is for something new I am working on called Promise Lifting.

Cheers!

Collapse
kip13 profile image
Collapse
jessegilbride profile image
Jesse Gilbride

The National Park Service API is easy to use, but does have a few bugs. (Hasn't been updated in a long time, maybe due to the last administration's defunding, etc.)

Spoonacular has a lot of endpoints, but the docs aren't great.

Also, there's this repo of public APIs: github.com/public-apis/public-apis

Collapse
joelnet profile image
JavaScript Joel Author

National Park Service has an API. That's interesting. πŸ€”

Collapse
jessegilbride profile image
Collapse
shailennaidoo profile image
Collapse
pelmenept profile image
Collapse
joelnet profile image
JavaScript Joel Author

Great question!

My use-case is I am writing documentation for a library (MojiScript) and want to provide example code that is runnable and also a real-world usage type example.

My second use-case is I write a lot of articles that demonstrate JavaScript code. I also want these examples to be runnable. I also want them to be more relatable to the readers real life use cases and not some contrived examples.

Something like a web server is too heavy for these types of demonstrations.

I'm sure there are many other valid use cases for them, otherwise they would not exist.

Soon we’ll be looking for the 3rd party services that write the code we need for us.

I think they call this NPM.

Collapse
davidchase profile image
Collapse
joelnet profile image
JavaScript Joel Author

Awesome a whole list of public APIs. I'm sure I'll find something perfect for my use case in here.

Cheers!

Collapse
annegentle profile image
Anne Gentle

deckofcardsapi.com - data model makes sense, no auth so easy on ramp, JSON readability that’s within reach and visual if you want.

Collapse
joelnet profile image
JavaScript Joel Author

That is an interesting API. I haven't seen that one. I'll have to keep this one in mind.