Api Design easy
You want to document your REST API in a machine-readable format that can generate client SDKs. What specification should you use?
- A OpenAPI (Swagger) Specification.
- B WSDL (Web Services Description Language).
- C Postman Collection exports.
- D Javadoc-generated HTML pages.
Answer: A. OpenAPI (Swagger) Specification.
**OpenAPI** (formerly Swagger) is the widely adopted standard for defining RESTful interfaces. It creates a machine-readable contract (JSON/YAML) that describes endpoints, parameters, and schemas. This allows for powerful tooling validation, automated SDK generation, and interactive documentation, serving as a single source of truth for the API.
One system design question a day, with spaced repetition so the ones you miss come back.
Get the appRelated questions
- You're designing a REST API for a blog. Which endpoint best represents 'get all comments for post 123'?
- A client wants to update only the 'status' field of an order, leaving other fields unchanged. Which HTTP method is most appropriate?
- A client calls POST /users with valid data, and the user is created. What status code should the server return?
- A client retries a failed 'POST /payments' request due to network timeout. The server receives the request twice. Without idempotency handling, what can happen?
- An API returns 10,000 products. Returning all in one response is impractical. Which pagination approach is simple and stateless?
- Your API serves both mobile apps and third-party integrations. Which authentication method is most appropriate?