This course has been updated! We now recommend you take the API Design in Node.js, v4 course.
Transcript from the "API" Lesson
>> Scott Moss: Let's just get a really good primer here, I know we have a lot of front end people here. Maybe this is your first time building an API. So what exactly is an API? Kevin, what is an API?
>> Kevin: What makes it possible for one program to talk to my data.
>> Scott Moss: There you go. Yep that's basically it. So TLDR, it's the server that creates, this is just my long explanation. A server that creates an HTTP interface for interacting with some data. At least in the context of building a rest API. I mean, the term API is used very broadly across like everything.
[00:00:38] But in the context of servers, it's something that's over HTTP. That defines some interface for interacting with some data, usually a database. But it could be some other server. It's short for Application Programming Interface. I guess, that was created way before I was born. So [LAUGH]. The name is used everywhere, right?
[00:01:01] Literally, people say APIs, and they're not just talking about servers. They're talking about, well, what's the API for your component? What's the API for this function? What's the API for your GitHub library? What's the API for your developer tool? Literally, it's used everywhere. But in this context, we're gonna be talking about servers.
[00:01:17] Like I said, it's usually a server on some remote machine that dictates how another application can interact with some data. Right, so if you have a front end client, like a react app or an angular app, and you want to interact with some data on the database over here, the API determines how you interact with it.
[00:01:35] Like, what are the format? What are the routes? What are the verbs? What are the headers? What are the query params? The API is determining that, so it's the interface of how you interact with that data. So usually most APIs their interface is built around what I like to call CRUD or what other people call CRUD.
[00:01:54] Which is short for Create, Read, Update, and Destroy, so if we have data sitting on a database. We want to do operations, we want to create new data so, for instance, I wanna. When someone signs up I'm creating a new user. I wanna be able to read that data as in I have a page on my [INAUDIBLE] app that shows the user settings.
[00:02:12] So I need to read that user and pull it down. I have an update where I'm gonna update the email or the password of this user. And then I have a destroy, which is deleting this user's account. So, it's the usual operations that people want to perform or applications want to perform on a database, so the API because it's sitting in front of the database, and it's the layer between the client and the database.
[00:02:34] It has to allow you to perform those operations somehow. And there's a lot of ways to do it. The one we're gonna be talking about today is gonna be called REST. That's the interface that we're gonna be describing.