API API Documentation and Design 1 — Questions and Answers
Question 1: What is OpenAPI Specification (OAS)?
- A programming language for APIs
- A standard format for describing REST API structure and behavior (Correct answer)
- An API testing framework
- A server infrastructure standard
Correct answer: A standard format for describing REST API structure and behavior
OpenAPI Specification is a standard, language-agnostic format for describing REST APIs, enabling automated tooling for documentation and testing.
Question 2: Which file format is most commonly used for OpenAPI 3.0 specifications?
- CSV
- JSON or YAML (Correct answer)
- XML
- INI
Correct answer: JSON or YAML
OpenAPI 3.0 specifications are most commonly written in YAML or JSON format, with YAML preferred for human readability.
Question 3: What is Swagger UI used for?
- Writing API code
- Rendering interactive API documentation from an OpenAPI spec (Correct answer)
- Load testing APIs
- Generating test data
Correct answer: Rendering interactive API documentation from an OpenAPI spec
Swagger UI renders an interactive web interface from an OpenAPI specification, allowing developers to explore and test APIs directly in the browser.
Question 4: What is 'API versioning' and why is it important?
- Tracking API uptime
- Managing changes to an API without breaking existing clients (Correct answer)
- Counting API users
- Version-controlling the server OS
Correct answer: Managing changes to an API without breaking existing clients
API versioning allows evolving an API with breaking changes while maintaining backward compatibility for existing clients.
Question 5: Which API versioning strategy includes the version in the URL path?
- Header versioning
- URL path versioning (Correct answer)
- Query parameter versioning
- Media type versioning
Correct answer: URL path versioning
URL path versioning embeds the version in the URL (e.g., /api/v1/users), making it explicit and easy to route.
Question 6: What does 'API-first design' mean?
- Building the API before the front end and back end
- Designing the API contract before writing implementation code (Correct answer)
- Prioritizing API performance over features
- Deploying the API before testing
Correct answer: Designing the API contract before writing implementation code
API-first design means defining the API contract (OpenAPI spec) before writing any implementation, aligning teams and enabling parallel development.
What is OpenAPI Specification (OAS)?