Google Cloud Comprehensive
Objective Assessment of API
Architecture objective 2 API
architecture (questions and
answers)
GSP294
1. Overview
API (Application Programming Interface) architecture defines the design
principles and protocols enabling software systems to communicate. It
encompasses protocols, data formats, authentication, scalability, security,
and developer experience, tailored to diverse use cases and technological
needs.
2. Architectural Styles
REST (Representational State Transfer)
o Strengths: Stateless, cacheable, uses standard HTTP methods
(GET, POST). Widely adopted with extensive tooling (Swagger,
Postman).
o Weaknesses: Over/under-fetching data, no built-in standards for
versioning.
o Use Cases: Web services (e.g., Twitter, GitHub APIs).
GraphQL
, o Strengths: Client-defined queries reduce data transfer; single
endpoint simplifies versioning.
o Weaknesses: Complex query optimization; potential for abusive
queries.
o Use Cases: Apps requiring flexible data retrieval (e.g., Facebook,
Shopify).
SOAP (Simple Object Access Protocol)
o Strengths: Rigid standards (WSDL), built-in security (WS-
Security).
o Weaknesses: Verbose XML payloads; poor performance.
o Use Cases: Enterprise systems (e.g., financial services).
gRPC
o Strengths: High performance (HTTP/2, binary Protocol Buffers);
bidirectional streaming.
o Weaknesses: Limited browser support; steep learning curve.
o Use Cases: Microservices, IoT (e.g., Netflix, Google Cloud).
Event-Driven APIs
o Strengths: Real-time data flow (WebSockets, MQTT).
o Weaknesses: Requires robust event brokers (Kafka, RabbitMQ).
o Use Cases: Live notifications, chat apps.
3. Security
Authentication: OAuth 2.0 (REST/GraphQL), API keys, JWT.
Encryption: HTTPS mandatory; SOAP uses WS-Security for XML
encryption.
Vulnerabilities: REST (insecure endpoints), GraphQL (query
complexity attacks), SOAP (XML exploits).
4. Scalability & Performance
REST: Horizontal scaling via stateless servers; caching (CDNs)
enhances performance.
GraphQL: Query depth limiting and pagination prevent overload.