Need help getting quotes from public APIs ( random quote machine project )

Can somebody tell me the way to get quotes from the APIs ?

Which API are you using? What have you done so far? Can you provide a link to your code (preferably in a CodePen)? Right now I’m trying to solve the random that does not repeat to last quote
I can create array to store quotes and author, but i prefer to use API to get quote.

There isn’t a requirement to pull the quotes from an API. You can just fill an array with them and go from there.

Your next step should be to choose an API that you want to use. A fellow camper has made a random quote API here that you can use.

I just try to do it by getting quotes from API in order to use it in the future I think
But thank you anyway.

So u think I just create an array and copy those quotes into it.

No, you can get a quote in your program by using that API.

I think this particular project was designed so we can practice the things we learned in the JSON APIs and Ajax chapter. So I’d try my best to pull data from an actual API, since you won’t be able to avoid posting to Twitter anyway :wink:

I just finished this assignment. I think that the intended solution need NOT use a public API nor a hardcoded array per se. The point, I figure, is to learn how to build and extract information from JSON objects which would be an extension of the lessons right before it. A flurry of googling on my part resulted in me thinking that it should be possible to create a json object in one code pen and link to it using AJAX (as in the cats’ picture example). Also see

Alas, I couldn’t get it to work. I’m convinced it is because of the issue that CodePen is converting to all https. Here is a link to the notice: Since my request was using http: I got the “mixed content” error. By next month (June 1), this is supposed to be a non-issue.

As a workaround, I just linked to the CodePen js file under settings. That allows one to the use the JQuery functions (filter(), forEach()) as in the cat example, but doesn’t require invoking the getJSON method. This I think is the best solution, at least for now.

I just can’t retrieve data via API. What’s wrong with this code:

var currQuote;
var quoteText = document.getElementById("quote");

function nextQuote() {
  quoteText.innerHTML = currQuote;

function changeQuote() {
    $.get( "/api/quotes/random", function( data ) {
            currQuote = data.quote;

function tweet(){"" + currQuote);

I have the following HTML code:

<div class="quote-box">
  <i class="fa fa-quote-left"></i>
  <div class="quote-text" id="quote">
    <!--quote here-->
  <i class="fa fa-quote-right"></i>
  <button class="change-button"
    Random Quote
  <button class="tweet-button" 
  <i class="fa fa-twitter"></i>