-
What are the three common types of parameters in an API request?
- Path Parameters: Used to identify a specific resource in the URL.
- Query Parameters: Used to filter or modify the request, typically included in the URL after a
?.
- Header Parameters: Used for metadata such as authentication tokens, content type, or API versioning.
-
How do path parameters differ from query parameters in an API request?
- Path Parameters: Define a specific resource and are part of the URL (e.g.,
/users/{id}).
- Query Parameters: Used to filter, sort, or modify a request and are appended to the URL after a
? (e.g., /users?id=123).
-
Differentiate between REST API and GraphQL API.
- REST API: Uses multiple endpoints for different resources, relies on HTTP methods, and often returns fixed data structures.
- GraphQL API: Uses a single endpoint where clients specify the exact data they need, reducing over-fetching and under-fetching.
-
Describe the features of WebSocket.
- Full-duplex communication
- Persistent connection
- Low-latency data transmission
- Suitable for real-time applications like chat apps, live notifications, and stock price updates
-
What is the primary advantage of SOAP APIs over REST?
- SOAP APIs provide built-in security (WS-Security) and transactional reliability, making them suitable for financial and enterprise applications.