Random Quote generator - How to start

Random Quote generator - How to start


Hi so up until this point I’ve felt capable of doing all the assignments and I know it’s not supposed to be easy but I’m not quite sure where to start. I can build the html and css framework and do all the design stuff but I don’t think I understand API’s enough to do the actual randomization of the quotes (if API’s are even necessary? Also it should be apparent that I’m not quite sure what API’s do which is probably neglect on my part) Short of just looking up the code I’m open to all suggestions of how to get a better understanding of how to do this.
Thanks for your help guys


Hey ayembocx,

An API is a way to request data from a website. After the website sends you the data, you can then decide how to display it in your application. Most API’s are going to send the data in JSON format. Here is a link you can play with to better understand API’s: http://quotesondesign.com/wp-json/posts?filter[orderby]=rand&filter[posts_per_page]=1

Try chaning the 1 on the end to a 5. If you read the API documentation for that site, it will tell you how to write the URL to get the response/data you want.

Hope that helps.


Here is the documentation: https://quotesondesign.com/api-v4-0/


Hey ayembocx,

I was in the exact same situation but I found this video: https://www.youtube.com/watch?v=ecT42O6I_WI very helpful.

Hope that it will help you too.


Requirements of project

User Story: I can click a button to show me a new random quote.

User Story: I can press a button to tweet out a quote.

You don’t need to use an API. Start simple and get it working first. Like use an array of objects. That meets the project requirements above.

Once you get that working, then you can extend it to use an API.


Thanks all. I realize now I definitely need to do some more research before I can comfortably understand what I’m doing for this assignment. Any more suggestions and resources for knowledge are always welcome. Cheers.



I’m not going to add further about APIs because I think the rest of the guys did an awesome job covering the basics and explaining the main idea behind their functionality (along with the incredible resources they suggested to get you started).

But I am going to give you some general advice since you’re just getting started: don’t be intimidated by APIs (or anything else you don’t grasp immediately). Instead, always try to center down the project to the simplest thing you understand and start building from there.

You mentioned you’re working on a random quote generator page. You also mentioned you can put together the HTML/CSS framework with ease. Then all that’s left is handling the back-end, i.e, the data itself (the quotes).

If getting started with APIs is a tough step, I would suggest you start by hard-coding a few quotes and randomly generating them. You can do this by placing them in an array. That way you will get a first-hand view on how data is returned and how it should be handled. You will likely have to read up some more on JSON as the guys mentioned and figure out how to parse/handle the returned values.

Once you feel comfortable with this, start with APIs. The basic idea is that you will be calling a service that returns the data for you (instead of having it hard-coded in your code). Since you’ve already figured out how to manipulate that data and output it on your page, it will be child’s play from here on for you.

Best of luck with this.