Skip to main content

 

Application Programming Interface RESTful APIs

Mobile applications can retrieve data from the user’s device application, an online source, or the database.

Let’s start with API, which stands for application programming interface: It is a set of rules and protocols that allows different software applications to communicate with each other.

The number of APIs globally is growing rapidly, with Postman reporting typical growth of 39 percent in the last year.

More simply, In a restaurant, when you’re ready to order, you have a menu to make your food selection. You choose your desired dish. After finalizing your order, the waiter takes note of it and then takes it to the chef. The latter then prepares your meal accordingly, and the waiter serves it to your table. This process is straightforward for you as a diner since you don’t need to concern yourself with the steps of how the food is cooked. In this scenario, the waiter functions as an intermediary, similar to an API, serving as the vital link that establishes seamless communication between you and the kitchen.

Today, we have categories of API protocols, one of them is REST API is a method of communication between applications and web services.

Let’s dive a little deeper and understand more…

REST is Representational State Transfer. It’s an architecture style and set of constraints used for designing network applications and you can only say that an API is RESTful if specific constraints are met.

However, the following five constraints must be present for any application to be considered RESTful:

  • Client-server: the client sends requests to the server, and the server responds with data.
  • Stateless: each request from the client to the server must contain all the information needed to understand and process the request.
  • Cacheable: responses can be saved by a web browser, a server, or any system.
  • Layered: the system can be split into layers (a client can not necessarily tell if it is directly communicating with the server or an intermediate).
  • Have a uniform interface: the system should offer a uniform communication system to access the resources.
  • Code on demand (optional).

You already know that HTTP methods and status codes play an essential role in REST APIs.

Here is a list of the most used HTTP methods and which action you should initiate for those calls.

  • GET: Returns the requested resource. If not found, return a 404 Not Found status code.
  • POST: Creates a record. The POST request always comes with an HTTP request body containing JSON or Form URL encoded data, which is also called a payload.
  • PUT: Update a specified resource: A PUT request deals with a single resource.
  • PATCH: Tells the API to update a part of the resource. Note the difference between a PUT and a PATCH call. A PUT call replaces the complete resource, while the PATCH call only updates some parts. A PATCH request also deals with a single record.
  • DELETE: Delete a resource.

See you in the next part 2 of my Blog article about REST API …, Take care!!

Comments

Popular posts from this blog

  Mastering Angular Basics In this blog, we will understand the Core Concepts of Angular What is Angular? A framework designed for building client-side using TypeScript It’s used for building dynamic, single-page applications (SPAs) What are single-page applications? It is a web application implementation that loads a single web document and then updates the content of its body as the user interacts with the application. Component It is a fundamental building block of an application. (every Angular application has at least one Root component ). They encapsulate a unit of functionality, including HTML, CSS, and TypeScript logic. app.component.ts : TypeScript file that contains the logic for the root/app component. app.component.html : HTML template file that defines the structure and content of the app component's view. app.component.css : CSS stylesheet file that contains the styles for the app component's appearance. Components are reusable A component includes a Type...
  CSS with superpowers T his blog aims to improve your CSS abilities, clean up your code, and save a lot of time by using Sass . Sass , which stands for S yntactically A wesome S tylesheet, is a Cascading Style Sheets (CSS) extension and has the “ .scss ” file extension. it is completely compatible with all versions of CSS. In addition, Sass has more features and capabilities than any other CSS extension language currently available and There are an endless number of frameworks built with it: Compass, and Bourbon, are just a few examples.           Check out for more :           https://sass-lang.com/ However, Sass includes extra features such as CSS variables and nested rules, which make CSS more efficient and easier to edit. Begin with the CSS variables . For instance, with CSS, if color is one that we commonly use, we must define it each time we want to utilize it. When using Sass , it is much simpler becau...
  Am I an entrepreneur? Are you an entrepreneur? You are an entrepreneur when you saw a need and assumes the risks of a business or enterprise. An   entrepreneur  is an individual who creates a new business, bearing most of the risks and enjoying most of the rewards. The process of setting up a business is known as entrepreneurship. The entrepreneur is commonly seen as an innovator, a source of new ideas, goods, services, and business/or procedures. According to SBA, Over 627,000 new businesses open each year, At the same time, about 595,000 businesses close each year (latest statistics as of 2008). 43% knew someone who had stopped a business in 2020 as a result of the pandemic, while 25% knew someone who had started a business amid the pandemic as stated in the   Global Entrepreneurship Monitor Research . let’s start with the profile of a good entrepreneur : Growth mindset : it’s a concept developed by Carol Dweck so he concluded that individuals who believe their t...