WEBVTT

00:00.000 --> 00:04.640
Building RESTful APIs

00:04.640 --> 00:11.440
In this lesson, we will understand REST principles and common HTTP methods used in APIs.

00:11.440 --> 00:15.520
Create simple REST API and points in Java and Python.

00:15.520 --> 00:22.880
Perform and test basic crud operations using RESTful APIs.

00:22.880 --> 00:26.640
REST principles

00:26.640 --> 00:33.680
REST stands for representational state transfer, and it is one of the most common architectures used to build APIs today.

00:33.680 --> 00:40.320
REST APIs follow stateless communication, meaning each request from a client contains all the information needed.

00:40.320 --> 00:43.360
The server doesn't store session details.

00:43.360 --> 00:51.360
REST uses resource-based URLs and standard HTTP methods such as Get, Post, Put, and Delete.

00:51.360 --> 00:58.160
Most REST APIs exchange data in JSON format, which is easy for both humans and machines to read.

00:58.160 --> 01:06.800
In short, REST provides a simple and standardized way for applications to interact with data over the web.

01:06.800 --> 01:13.360
Setting up a basic API in Java, Java developers commonly use Spring Boot to build REST APIs.

01:13.360 --> 01:18.960
With Spring Boot, you define a controller class, map end points, and return JSON responses.

01:18.960 --> 01:20.880
Here's an example from the image.

01:20.880 --> 01:25.920
In this example, at REST controller defines the class as a REST controller.

01:25.920 --> 01:29.760
At request mapping sets the base URL for the endpoint.

01:29.760 --> 01:34.960
At Get mapping handles Get requests and returns a list of products as JSON.

01:34.960 --> 01:43.280
This is how Java applications expose API end points that other apps can call.

01:43.280 --> 01:46.720
Setting up a basic API in Python.

01:46.720 --> 01:51.280
In Python, REST APIs are often created using Flask.

01:51.280 --> 01:52.800
Here's the example.

01:52.800 --> 01:58.640
This simple code defines a route API and products.

01:58.640 --> 02:00.960
Uses the Get method.

02:00.960 --> 02:03.840
Returns data in JSON format.

02:03.840 --> 02:12.800
Flask makes it easy to test API end points locally using a browser or CURL commands.

02:12.800 --> 02:15.840
Crout operations and practical exercise.

02:15.840 --> 02:20.240
REST APIs commonly use CRUD operations.

02:20.240 --> 02:23.440
Get Retrieve resources.

02:23.440 --> 02:26.800
Post, create new resources.

02:26.800 --> 02:31.280
Put or patch, update existing resources.

02:31.280 --> 02:34.160
Delete, remove, resources.

02:34.160 --> 02:40.240
These operations help manage collections like products, students, books, or user profiles.

02:40.240 --> 02:44.480
For example, a simple classroom task is to build an API

02:44.480 --> 02:48.720
to manage a list of students, including Get All Students.

02:48.720 --> 02:51.920
Get a specific student.

02:51.920 --> 02:53.280
Post a new student.

02:53.280 --> 03:00.400
Students can test each endpoint locally to see how the JSON response changes with each action.

03:00.400 --> 03:04.560
RESTful APIs form a major foundation of modern software.

03:04.560 --> 03:09.840
By understanding REST principles, creating simple APIs in Java and Python.

03:09.840 --> 03:13.280
And practicing CRUD operations, you gain the skills to build

03:13.280 --> 03:16.000
and manage real-world web services.

03:16.000 --> 03:19.520
This knowledge is essential for anyone interested in app development,

03:19.520 --> 03:23.280
backend systems, or full-stack engineering.

