Quiz: APIs and Integrations
Test your understanding of APIs, REST, GraphQL, authentication, data formats, and integration architecture with these review questions.
1. What does the acronym API stand for?
- Automated Programming Interface
- Application Programming Interface
- Application Protocol Integration
- Automated Process Integration
Show Answer
The correct answer is B. An API is an Application Programming Interface - a standardized contract that defines how separate software systems communicate with each other. As the chapter explains, an API specifies what requests a system accepts, what data it expects, and what responses it returns, much like a restaurant menu that tells you what you can order and what you will receive.
Concept Tested: API Fundamentals
2. Which HTTP method is used to create a new resource in a REST API?
- GET
- DELETE
- PUT
- POST
Show Answer
The correct answer is D. According to the chapter's HTTP methods table, POST maps to the Create operation in CRUD. The chapter provides the example POST /api/v1/products to add a new product to a catalog. POST is also notable for being the only non-idempotent primary HTTP method, meaning submitting the same request twice creates two separate resources.
Concept Tested: HTTP Methods
3. What problem does GraphQL solve that REST commonly encounters when a mobile app needs data from multiple related resources?
- GraphQL eliminates the need for API authentication on mobile devices
- GraphQL uses binary encoding to reduce mobile bandwidth consumption
- GraphQL allows the client to request exactly the data it needs in a single request, avoiding over-fetching and under-fetching
- GraphQL automatically caches all responses on the client device for offline use
Show Answer
The correct answer is C. The chapter explains that GraphQL solves two common REST problems: over-fetching (getting more data than you need) and under-fetching (needing multiple requests to assemble the data you want). The chapter gives the specific example of a mobile app needing a user's name and their three most recent orders, which would require two REST calls but only one GraphQL query.
Concept Tested: GraphQL Overview
4. A developer receives a 429 status code when calling your product's API. What does this indicate?
- The server encountered an internal error and cannot process the request
- The requested resource was not found at the specified endpoint
- The client has sent too many requests and has been rate limited
- The client's authentication credentials have expired
Show Answer
The correct answer is C. The chapter's HTTP status code table lists 429 as "Too Many Requests" under the 4xx Client Error category. This status code is directly tied to API rate limiting, which the chapter defines as a mechanism that restricts the number of API requests a client can make within a specified time period to protect APIs from abuse and ensure fair usage across all consumers.
Concept Tested: API Rate Limiting
5. Your company's product needs to integrate with a payment processor that sends real-time notifications when a charge succeeds or fails. Which integration pattern should you recommend?
- Polling the payment processor's API every few seconds for status updates
- Using webhooks so the payment processor pushes event notifications to your system
- Embedding the payment processor's SDK directly into the database layer
- Setting up a shared database between your system and the payment processor
Show Answer
The correct answer is B. The chapter specifically uses payment processing as its primary webhook example, explaining that without webhooks, your system would need to check Stripe every few seconds asking "did the payment go through yet?" With webhooks, the payment processor sends your system a notification the instant the payment succeeds or fails. This push-based approach is more efficient and provides near-real-time data compared to polling.
Concept Tested: Webhooks
6. Which data serialization format dominates modern API development and is used by over 95% of new APIs?
- XML
- YAML
- JSON
- CSV
Show Answer
The correct answer is C. The chapter's comparison table between JSON and XML explicitly states that JSON has "Dominant (95%+ of new APIs)" modern API usage, while XML is relegated to "Legacy and enterprise systems." JSON's advantages include readability, compact size, native browser support via JSON.parse, and its lightweight human-readable syntax of key-value pairs and arrays.
Concept Tested: JSON Format
7. What is the primary purpose of an API gateway in a microservices architecture?
- It stores all application data in a centralized database for faster access
- It acts as the single entry point for all API requests, handling authentication, rate limiting, routing, and logging
- It translates REST API calls into GraphQL queries for internal services
- It generates API documentation automatically from source code comments
Show Answer
The correct answer is B. The chapter defines an API gateway as a server that acts as the single entry point for all API requests, sitting between external clients and internal services. It handles cross-cutting concerns including authentication, rate limiting, request routing, logging, and response transformation so that individual services do not have to implement these capabilities themselves. The chapter lists five specific benefits: unified entry point, security enforcement, traffic management, analytics, and version management.
Concept Tested: API Gateway
8. Your team is evaluating whether to build SDKs for your public API. A stakeholder asks why you cannot just rely on the API alone. How would you explain the difference between an API and an SDK?
- An API defines the communication contract while an SDK provides pre-built, language-specific toolkits that simplify integration by handling authentication, request construction, and error handling
- An API is used only for internal communication while an SDK is required for any external developer access
- An API supports only REST calls while an SDK is required to enable GraphQL queries
- An API handles data storage while an SDK manages the user interface components of the integration
Show Answer
The correct answer is A. The chapter's API vs. SDK comparison table clearly distinguishes the two: an API is "a contract defining how systems communicate" while an SDK is "a toolkit for building against the API." The chapter uses the analogy that an API is like LEGO instructions while an SDK is a pre-assembled LEGO kit with helper tools. SDKs reduce developer effort and time to first integration, but each SDK must be maintained per language, which multiplies maintenance work.
Concept Tested: SDK Overview
9. Your engineering team proposes changing the API endpoint structure. Several external partners have built integrations against the current endpoints. What practice should you insist on to prevent breaking their systems?
- Sending email notifications to all partners 24 hours before changes go live
- Requiring partners to rebuild their integrations from scratch using the new endpoint structure
- Implementing API versioning with a deprecation policy that provides adequate migration time
- Switching all partners to use your SDK so endpoint changes become invisible
Show Answer
The correct answer is C. The chapter emphasizes that APIs are contracts, and changing that contract without warning can cause partner systems to fail. API versioning provides a migration path, with common strategies including URL versioning (e.g., /api/v1/ vs. /api/v2/), header versioning, and query parameter versioning. The chapter notes that a typical deprecation policy provides 12-18 months of notice before sunsetting a version, determined by consumer count, maintenance cost, and contractual obligations.
Concept Tested: API Versioning
10. An engineering team claims their API has good error handling, but external developers frequently submit support tickets because they cannot diagnose failures. Which element is most likely missing from their error responses?
- Rate limiting headers that show remaining request quotas
- Specific error codes, clear messages identifying the problem field, and documentation links for remediation
- Automatic retry logic built into the API response headers
- GraphQL query suggestions that help developers reformulate their requests
Show Answer
The correct answer is B. The chapter provides a specific example of a well-structured error response that includes an error code ("INVALID_PARAMETER"), a clear message ("The email field must be a valid email address"), the specific field ("email"), and a documentation URL for remediation. The chapter contrasts this with APIs that return cryptic "500 Internal Server Error" messages, stating that specific, actionable error messages help developers self-serve and directly affect developer experience and integration success rates.
Concept Tested: API Error Handling