Here’s a list of 6 Random Quote APIs for your projects.
It’s quite a common thing to build a project that builds on the data supplied by an API. Whether it’s just for a bit of fun or your trying to add a project to your portfolio it’s a definitely a good way to demonstrate your skills in handling AJAX requests and the parsing of the returned data. Out of all the courses, tutorials, bootcamp-style training i’ve taken it’s quite common to be asked to create a random quote generator app/web-page. So I thought i’d put together a list of freely available random quote APIs where you can request your random quote data from. It’s just up to you then to format it how you would like :)
Quotes On Design
Endpoint: https://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1 Authentication: Not required A great site to find inspirational and sometimes amusing quotes about design. The data you get back contains the author name and the quote which, for better or for worse, includes formatting with some HTML tags.
Forismatic.com
Endpoint: https://api.forismatic.com/api/1.0/?method=getQuote&lang=en&format=jsonp&jsonp=? Authentication: Not required If you’re confused what URL endpoint to use to actually GET data from this API, use the one provided above. I feel like the home page doesn’t make this really that clear! The response you get has properties for author name and quote text. There are lots of quotes from a wide range of people on this one.
Random Quote Generator
Endpoint: https://random-quote-generator.herokuapp.com/api/quotes/random Authentication: Not required This was a random quote API that I found whilst searching for building one of these quote apps. There’s a good range of quotes available but it’s hosted on a Heroku account so who knows when it may stop working :)
Storm Consultancy
Endpoint: http://quotes.stormconsultancy.co.uk/random.json Authentication: Not required If you’re looking for some techy random quotes for your app, this API provided by Storm Consultancy will be right up your street. Your author and quote text are separated into properties.
What Does Trump Think
Endpoint: https://api.whatdoestrumpthink.com/api/v1/quotes/random Authentication: Not required A bit more of a controversial one here but if you’re looking for something political this will come in handy. I’m not sure if these are genuine Trump quotes but the API does respond back with a structure of the quote which might be useful for some purposes.
Random Famous Quotes
Endpoint: https://andruxnet-random-famous-quotes.p.mashape.com/ Authentication: Required Our final API has some famous quotes (as the name suggests!) however you’ll need to sign up and get an API key to retrieve a quote. It’s also different from the other APIs listed here as you need to send a POST request instead of a GET request.
Conclusion
I hope you’ve found some inspiration for creating a random quote project with these APIs. If you’re stuck for the next step, check out the video on how to retrieve values using AJAX / jQuery.