Introduction to APIs, JSON, and XML
Zenva
ACCESS the FULL COURSE here: https://academy.zenva.com/product/data-science-mini-degree/?zva_src=youtube-datascience-md
TRANSCRIPT
Hello everyone, and welcome to our tutorial on API's, JSON, and XML. Here we're going to bundle three topics into one, and we're basically just gonna show you a series of slides, parade some information about these three topics, and we'll take a look at a couple of examples of JSON, and XML data as well. So, for starters, what is an API? And API stands for an Application Programming Interface, and it's kind of a way to connect an application to a database. We can think about an API as being a bit like a messenger that communicates with the application on the database, and runs data back and forth. So we can use this to upload data to a database, or retrieve data from a database, or maybe do some modifications as well. So the way in which we use APIs typically starts by specifying what kind of data we want with a URL. We use this to request data. So within a URL, we will put the parameters that we want, and we'll use these parameters as a series of filters. For example, let's say we're retrieving stock data. Maybe we'll want a start and an end date, we'll obviously want the stock we're retrieving data from, we'll want maybe a limit, so maybe we want the previous ten days, or the previous 20 days, or something like that. Perhaps the type of data that we want back, do we want XML data, or do we want JSON data? And very often with most of the API's I've used actually, I've had to create an account in there, some kind of a key that's associated with that. We'll be using a dataset that doesn't need a key, because it's gonna be open source, and that'll be easier for everyone. So, once we specify what kind of data want with a URL, again, it's just kind of a series of filters. Then, we make a data request, we retrieve that data, and once we have that dataset, we parse it. Now the way in which we parse it depends on whether we have XML or JSON data.
As you saw with Beautiful Soup in the previous tutorials, assuming that you watched those, we parsed some HTML data. Well, we're gonna follow a very similar process, selecting the pieces of data that we want, kind of sourcing them into variables, and stuff like that, and then we can use those variables as we want in our application. So what about JSON, what's JSON? JSON stands for JavaScript Object Notation, and it's a way to store and transport data. So JSON files don't run, they're not like executable files, it's basically just a dataset. And JSON acts like a big dictionary, or if you prefer the term map, but basically the same thing. It's a series of key value pairs, where the keys are typically strings, and the values could be anything from objects to arrays, to strings, or othe ... https://www.youtube.com/watch?v=Q-Z-bjDcxFg
24376235 Bytes