API Contracts define the formal agreement between an API provider and its consumers, specifying how they interact, what data they exchange, and how to handle success or failure. Contracts describe API behavior, including request formats, HTTP methods, and expected responses. For example, the API contract for retrieving a Cash Card would specify that a GET request to /cashcards/{id} returns the card's details in JSON format if the request is successful (200 OK), or an error if not (e.g., 401 Unauthorized or 404 Not Found).

Why API Contracts Matter: API contracts help both the provider and consumer understand how to interact with each other and can be turned into automated tests to ensure everything works as expected. These contracts are essential in ensuring consistent API behavior.

JSON (JavaScript Object Notation) is a lightweight and widely-used data interchange format for APIs. JSON is human-readable, compact, and works well with most modern programming languages. It's preferred over XML for web-based APIs due to its simplicity and performance.

Key Points:


API 계약의 중요성: API 계약은 제공자와 소비자가 서로 어떻게 상호작용해야 하는지를 명확히 하며, 자동화된 테스트로 쉽게 전환할 수 있어 안정적인 API 작동을 보장합니다.

핵심 사항: