Город МОСКОВСКИЙ
00:03:47

rest Api example JavaScript || Fetch API JavaScript example in 1-minute || Json #restapi

Аватар
JS Волшебство кода
Просмотры:
22
Дата загрузки:
28.11.2023 22:52
Длительность:
00:03:47
Категория:
Обучение

Описание

n this example, we define a URL and a JSON data object. We then use the fetch API to make a POST request to the URL, specifying the request method, headers, and body.

We set the Content-Type header to 'application/JSON to indicate that the request data is in JSON format. We also use JSON.stringify() method to convert the data object to a JSON string before sending it in the request body.

Once the response is received, we extract the JSON data using the .json() method and process it somehow.
index:
00:00:00 - intro.
00:00:20 - rest Api example JavaScript || Fetch API JavaScript example.

GitHub link:
https://github.com/reja-e-rabbi/spark

Follow Me on LinkedIn:
https://www.linkedin.com/in/reja-e-rabbi-sarkar-62103a13a/

#javascript #restapi #fetchapi

REST stands for Representational State Transfer, and it is an architectural style that is used for designing web-based applications. RESTful APIs (Application Programming Interfaces) are a way of exposing the functionality of a software system to other systems or applications via HTTP requests.

A RESTful API is an API that adheres to the principles of REST architecture. These principles include using HTTP methods (GET, POST, PUT, DELETE, etc.) to perform CRUD (Create, Read, Update, Delete) operations on resources identified by unique URIs (Uniform Resource Identifiers), using standard data formats such as JSON (JavaScript Object Notation) or XML (Extensible Markup Language) for representing data, and being stateless.

In a RESTful API, each resource (such as a user or a product) is identified by a unique URI, and different HTTP methods are used to interact with those resources. For example, a GET request might be used to retrieve information about a resource, while a POST request might be used to create a new resource.

RESTful APIs are widely used for building web-based applications, and they have become the standard way of accessing web services. They are popular because they are simple, flexible, and scalable, and because they can be used with a wide range of programming languages and platforms.

Рекомендуемые видео