The potential for programming REST APIs is essentially limitless, and it has never been easier to get started with your own API project.
The potential for programming REST APIs is essentially limitless, and it has never been easier to get started with your own API project. The most popular modern languages, frameworks, and platforms all provide rich support for all types of HTTP-based services, including REST. It is not necessary to be a highly experienced developer to build and maintain a REST API because of the many prepackaged solutions that get the API up and running, as well as the large and talented community of technical experts who create and manage these tools.
Three of the most popular programming languages in use today are JavaScript, Python, and C#. You will learn how to build REST APIs in each of these languages and their corresponding server runtimes. Each of these will entail the configuration of OpenAPI-compatible services that produce the familiar OpenAPI documentation.
You also will learn how to build a REST API in Node.js using Express, in Python using Flask, and in .NET Core using Swashbuckle using prepackaged starter implementations.
Learning Objectives:
- Identify REST API server solutions in Node.js, Python and .NET
- Leverage prepackaged solutions for each language/platform
- Explain how to generate automated OpenAPI documentation in each language
Skills you’ll gain
API DesignAPI ManagementCore APIREST API DevelopmentRest ClientRESTful APIWhat You'll Learn
- Build REST APIs in JavaScript, Python, and C# along with their corresponding server runtimes
- Create REST APIs in Node.js using Express, Python using Flask, and .NET Core using Swashbuckle with prepackaged starter implementations
- Identify REST API server solutions in Node.js, Python, and .NET
- Leverage prepackaged solutions for each language and platform to get an API up and running
- Generate automated OpenAPI documentation in each language
- Configure OpenAPI-compatible services that produce familiar OpenAPI documentation
Key Takeaways
- The most popular modern languages, frameworks, and platforms all provide rich support for HTTP-based services, including REST.
- JavaScript, Python, and C# are three of the most popular programming languages in use today, and this course covers building REST APIs in each.
- Prepackaged solutions and a large community of technical experts make it possible to build and maintain a REST API without being a highly experienced developer.
- Each language implementation involves configuring OpenAPI-compatible services that produce familiar OpenAPI documentation.
- The course demonstrates Express for Node.js, Flask for Python, and Swashbuckle for .NET Core using prepackaged starter implementations.
Frequently Asked Questions
Which programming languages does this course cover for building REST APIs?
The course covers JavaScript, Python, and C#, building REST APIs in each language and their corresponding server runtimes.
Do I need to be an experienced developer to take this course?
No. The course notes it is not necessary to be a highly experienced developer to build and maintain a REST API, thanks to the many prepackaged solutions and the large community of technical experts who create and manage these tools.
What frameworks and tools are used in the lessons?
The course builds a REST API in Node.js using Express, in Python using Flask, and in .NET Core using Swashbuckle, using prepackaged starter implementations.
Will I learn how to create API documentation?
Yes. You will learn how to configure OpenAPI-compatible services and generate automated OpenAPI documentation in each language.
What topics are covered in the lessons?
The lessons cover Node.js REST APIs with Express.js, Python REST APIs with OpenAPI documentation, and creating REST APIs using ASP.NET Core and C#.
Transcript
Show transcript (free preview lesson)
Transcript of the free preview lesson. Remaining lessons unlock with the full course.
Hello, my name is Josh Gardino. And in these lessons I will show you how to build simple APIs, using popular, and common frameworks. Let's begin with an exploration of node.js. Node.js server software, based on the JavaScript language. Let's take a look at the Department of Motor Vehicle's API, in its Open API documentation we have endpoints for drivers, registrations, and vehicles, for a variety of HTTP methods, including example values, sets of allowable values, such as those for vehicle makes, as well as the various status codes, that each endpoint might return. Here I am working in JetBrains WebStorm, which is a popular IDE, or integrated development environment, for JavaScript, and other web technologies. WebStorm is not free software, but JetBrains does offer a 30-day free trial. Here in WebStorm, I have a project called "Express-OpenAPI-Starter." Let's take a look at some of the files within this application. App.js starts the API, and leverages several libraries, imported from the public NPM repository, such as Express Open API, and Swagger UI Express. The code here that starts the application, provides a URL for the open API documentation, and the directory and the application, under which all of the information for the various paths will be stored. Now, let's open the API directory, which has three sub-directories. The first one that we will look at is data. To keep this example simple, I do not have the application reading data from a database, but as JSON objects stored in .js files. For example, drivers.json contains all of the driver information. This would certainly not be the way that a production system should operate, but for our purposes here, it should work just fine. There's also a file for registrations, and for vehicles. Now let's look in the paths directory. There is a V1 subdirectory, and then drivers registrations, and vehicles. So this directory structure directly reflects the API's URL, and path pattern. Index.js files are considered root files for each directory, and will contain all of the code for each supported method. Let's look at API/paths/V1/drivers index.js. This file contains code for each of the supported endpoints, such as get, which, on line seven, simply reads all of the drivers from the drivers.json file, and returns them. The post, put, patch, and delete methods, will change the driver information stored in memory, so that subsequent get requests will reflect these changes, although they are not stored back to the JSON files. This means that each time that the server is started. the data in the .json files is reset. And underneath the code that handles the different HTTP methods, is information about the Open API documentation. This refers back to a file called APIdoc.js. And here is where I designate the title, and the version, that are shown on the Open API documentation webpage, as well as definitions for the different types of objects, such as drivers and vehicles. To create fake values for the examples, I'm using a library called Faker, which simply creates fake names, addresses, and dates. The file shown in the directory structure, that have curly braces around ID, are those that support the methods, with IDs of drivers of vehicles, in the URLs. The index.js files also define the response code information. And all of this ties back directly to the Open API webpage documentation. Node.js by itself, does not possess the capabilities to run a web API, so let's use the most common web library for node.js, which is called Express JS. It's very easy to get up and running with a REST API, using node.js in Express. But of course, a real implementation of a production grade REST API would involve significantly more code. Thanks for watching. Stay tuned for the next lesson, where I will show you how to build a simple API using Python.
Learn on the Go
Take your learning anywhere — the KnowledgeCity mobile app lets you watch lessons on the go.