Skip to main content
Basic Knowledge of MIDAS API Created Edited

Terminology: REST API

shutterstock_2334663413.jpg

REST API

REST stands for Representational State Transfer, one of the architecture styles for communication between web services. It uses HTTP protocol to represent resources and transmit state. This web technology provides efficient and standardized communication between clients and servers.

REST API was introduced in Dr. Roy Fielding’s doctoral dissertation, which defines the network architecture and is used to exchange information on the web.

 

REST Architecture Principal: REST API follows several essential principles.

  • Resource Identification: Each resource (data or object) is identified by a Uniform Resource Identifier(URI).
  • Stateless: Each request contains enough information and is processed independently from the server.
  • Connectivity: Interaction between client and server is stateless, consisting of requests and responses containing necessary information.
  • Client-Server: The client and server develop independently and do not need to know each other.

 

HTTP Method and Resource

RESTful API accesses and operates resources using HTTP Methods(GET, POST, PUT, DELETE, etc.).

  • POST → Create resources
  • GET → Read resources
  • PUT → Update resources
  • DELETE → Delete resources

RESTful API identifies resources using URLs and interacts with resources using HTTP Methods.

For example, if a “GET” request is made using the URL “/user/jay”, the server will read the resource named “jay” under the “user” and give the response.

 

HTTP Response Status codes

REST API returns a response along with a response code (status code), and the most commonly used codes are as follows:

  • 200 OK: The request was successful.
  • 201 Created: A new resource was successfully created due to the request.
  • 400 Bad Request: The server could not understand the request, often due to invalid syntax.
  • 404 Not Found: The server can't find the requested resource.
  • 500 Internal Server Error: A generic error message returned when the server encountered an unexpected condition.

“404 Not Found” is a commonly encountered error when using the web browser.

 

Use cases for REST APIs:

REST APIs are widely used in various instances. Here are some representative used cases:

  1. Web & Mobile applications: REST APIs are widely used for building web services that allow the download of data from the web and mobile apps for updates. For example, Social media apps update user profiles, posts, lists of followers, etc., by using REST APIs.
  2. Integrating Cloud Services: Various cloud services (i.e., Dropbox and Google Drive) support file and data sharing through REST APIs and are utilized for integration with other applications.
  3. IoT (Internet of Things): IoT devices and applications often communicate with each other and cloud services through RESTful APIs.
  4. Payment Gateways: Online payment platforms use APIs to securely process payment transactions, handle credit card information, and manage payment gateways.
  5. Software Integration: Using REST APIs to integrate other software and systems. The REST APIs are utilized for data sharing and automation between enterprise systems.
  6. Data Analysis and Visualization: REST APIs fetch and integrate external data with data analysis and visualization tools. This enables real-time data display and report generation.
  7. Social Media Integration: Social media platforms provide APIs that allow developers to integrate features like sharing, authentication, and accessing user data.

These are just a few examples, and REST APIs are used in a wide range of industries and applications to facilitate communication and data exchange between different software systems.

0
Was this article helpful?