ReasonJun

REST (Representational State Transfer) API (Application Programming Interface) 본문

Frontend/Network

REST (Representational State Transfer) API (Application Programming Interface)

ReasonJun 2023. 6. 16. 01:34
728x90

REST, which stands for Representational State Transfer, is an architectural style for designing networked applications. It provides a set of principles and constraints for creating web services that can be easily consumed by clients over the internet. A REST API (Application Programming Interface) is an implementation of the REST principles that allows communication between clients and servers using the HTTP protocol.

 

Here are the key characteristics and principles of REST:

  1. Client-Server Architecture: REST separates the client and server components, allowing them to evolve independently. The client is responsible for the user interface and user experience, while the server handles data storage, processing, and management.
  2. Statelessness: Each request from a client to a server must contain all the necessary information for the server to understand and process it. The server does not maintain any client state between requests, which simplifies scalability and improves reliability.
  3. Uniform Interface: REST defines a uniform and standardized way to interact with resources through well-defined and consistent methods. The most common methods used in RESTful APIs are GET (retrieve resource), POST (create resource), PUT (update resource), and DELETE (remove resource).
  4. Resource-Based: In REST, resources are the key concept. A resource can be any entity or object that can be identified by a URI (Uniform Resource Identifier). Resources can have multiple representations, such as JSON, XML, or HTML, and the client can choose the appropriate representation based on its requirements.
  5. State Transfer: REST relies on the transfer of representations of resources between the client and server. For example, when a client requests a resource, the server responds with the representation of that resource in the requested format (e.g., JSON or XML).
  6. Hypermedia as the Engine of Application State (HATEOAS): HATEOAS is an optional constraint in REST that allows the server to provide links or URLs to related resources in the response. These links enable clients to navigate and discover additional resources dynamically without prior knowledge.

REST APIs are widely used in web development and have become the standard for building web services. They provide a simple and scalable approach to building distributed systems that can be consumed by a variety of clients, such as web browsers, mobile applications, or other servers.

 

When designing a RESTful API, developers should consider the following best practices:

  1. Use nouns to represent resources in the URI path rather than verbs.
  2. Leverage the appropriate HTTP methods (GET, POST, PUT, DELETE) for CRUD (Create, Read, Update, Delete) operations on resources.
  3. Structure the API endpoints logically and hierarchically based on the relationships between resources.
  4. Use proper status codes (e.g., 200 for successful responses, 400 for client errors, 500 for server errors) to provide meaningful feedback to clients.
  5. Provide versioning support to ensure backward compatibility as the API evolves over time.
  6. Implement authentication and authorization mechanisms to secure access to the API and protect sensitive resources.

By following these principles and best practices, developers can create well-designed and interoperable RESTful APIs that are easy to understand, use, and maintain.

 

https://blog.restcase.com/5-basic-rest-api-design-guidelines/

 

5 Basic REST API Design Guidelines

As soon as we start working on an API, design issues arise. Robust and strong design is a key factor for API success. A poorly designed API will indeed lead to misuse or – even worse – no use at all by its intended clients: application developers. Crea

blog.restcase.com

https://cloud.google.com/apis/design/documentation?hl=ko 

 

인라인 API 문서  |  Google Cloud

이 섹션에서는 API에 인라인 문서를 추가하는 데 사용되는 가이드라인을 제공합니다. 대부분 API에는 개요, 튜토리얼, 높은 수준의 참조 문서가 있지만 이 디자인 가이드의 범위에는 포함되지 않

cloud.google.com

https://github.com/Microsoft/api-guidelines/blob/master/Guidelines.md

 

GitHub - microsoft/api-guidelines: Microsoft REST API Guidelines

Microsoft REST API Guidelines. Contribute to microsoft/api-guidelines development by creating an account on GitHub.

github.com

 

728x90
Comments