These are chat archives for MontCode/GeneralChat

20th
May 2017
Lucas Morley
@Luc1100
May 20 2017 23:01
Would anyone be willing to help me to understand how to integrate APIs into my sites. I was able to figure out how to set up the link to generate a random quote (like if I put the link into my browser I can see the JSON), but actually integrating that into my webpage makes no sense to me and every youtube video seems to do it a different way, I am very lost
David Castner
@davidjcastner
May 20 2017 23:23
@Luc1100 it's a lot to grasp at once, But I can give it shot helping you out. For starters is there a specific task that you want you're site to accomplish?
Lucas Morley
@Luc1100
May 20 2017 23:27
It's the quote generator project
I figured out how to make the link which will ouput the JSON, but I don't know how to implement that into my site
David Castner
@davidjcastner
May 20 2017 23:30
okay so using an API would mean that instead of coding the quotes into your page. Your site would send a request to another site for the quote. The first thing would be to find a quote source that is free. I can't remember if I found one. But's let's start with a quick google search
is there a particular type of quote that you want to display?
Here is one: https://quotesondesign.com/api-v4-0/. They tell you use the endpoint: "http://quotesondesign.com/wp-json/posts"
David Castner
@davidjcastner
May 20 2017 23:35
What this means is that you can send a http request to the url "http://quotesondesign.com/wp-json/posts" and it will return a quote in some format
making sense so far? if not, let me know what isn't making sense
Lucas Morley
@Luc1100
May 20 2017 23:54
http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en I was using this one. What doesn't make sense is how I make it so that the data gets on to my webpage
Like I have absolutely no clue what to do with the link
David Castner
@davidjcastner
May 20 2017 23:57
You would need to do a HTTP Get request to that url, http://stackoverflow.com/questions/247483/http-get-request-in-javascript
Lucas Morley
@Luc1100
May 20 2017 23:59
See everyone seems to have a different way of going about this step which is overwhelming because I am not sure which to use