Created a Quote API for all to use!

Created a Quote API for all to use!
0

#21

It uses the js native XMLHttpRequest() constructor, but that’s actually a misnomer, because it can return formats other than XML. In this case, it returns a JSON string, which is then parsed using JSON.parse() to turn it into a usable JSON object.


#22

@lionel-rowe is there a specific reason you chose XMLHttpRequest over Jquery? Does one have greater interactivity or more performance gains over the other?


#23

This is awesome. I hope it helps out the future campers.


#24

If the JS you’re writing is optimal, native JS should typically be slightly faster than using libraries, though the difference should be fairly negligable. What’s slightly more worth considering is the size of the library code itself, which slows down page load times (however, assuming you have a decent internet connection, this should still be barely noticeable).

Mainly, I just wanted to try writing something in pure JS, as up until this point I’d used jQuery for almost everything other than a couple of rudimentary React projects. I think this is worthwhile as a learner, as it allows you to get a bit more into the nuts and bolts of the language, even if you’d typically be using libraries and/or frameworks on top of that in a professional setting.

Unfortunately, yes. Looks like it still has around 15% of US market share. Similar worldwide. It seems the vast majority of those users are using IE11 (which still doesn’t support ES6).

I’ve put the JS through Babel, but even then the code is completely failing to run in IE8. In the interests of striking a balance between keeping this thread alive and not derailing it, I’m starting a new thread about that here.


#25

Awesome! Thanks for making it. I just finished my Random Quote Generator using your API and it was a breeze.

It’s pretty basic, but here it is: https://codepen.io/drecali/full/RgZzaN/

PS. I don’t know much about APIs, but I think I used the AJAX method shown in the video below. It was my first time working with APIs so I proceeded cautiously and used console.log() to frequently check if the JavaScript code I was writing was working.

Thanks again @Jluboff!


#26

Awesome, great work! I’m really happy that people are using the API and enjoying it! My aim was to make something easy to use as other API’s can be quite challenging to understand and use :smiley:


#27

Just wanted to say thanks for doing this. I just finished the Apis and Microservices section and was going through my old projects and noticed my random quote machine no longer worked. Apparently the api I was using went away! Anyway, this is great and the quotes are a lot more fun than the ones I was getting. Thanks again!


#28

just found out my old project api was dead and i find this gem on google. thanks