Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2 views

API Testing

Uploaded by

thuanbakhac
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

API Testing

Uploaded by

thuanbakhac
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1.

RESTful API:

 REST (Representational State Transfer) is an architectural style for distributed systems


such as the internet.

 It is based on a client-server model where each service is viewed as a resource that can
be accessed via standard HTTP methods (GET, POST, PUT, DELETE).

 REST APIs are lightweight, easy to use, and widely adopted due to their simplicity and
compatibility with various platforms and programming languages.

 They typically use JSON (JavaScript Object Notation) for data exchange, which is
lightweight and easy for both humans and machines to read and write.

 RESTful APIs are stateless, meaning each request from a client contains all the
information necessary for the server to fulfill it, without requiring the server to store any
session information.

2. SOAP API:

 SOAP (Simple Object Access Protocol) is a protocol for exchanging structured


information in the implementation of web services.

 It relies on XML (Extensible Markup Language) for message format and HTTP or SMTP
for message negotiation and transmission.

 SOAP APIs are more rigid and complex compared to RESTful APIs, often requiring
specialized tooling for development and consumption.

 They offer features like security, transactions, and reliability, making them suitable for
enterprise-level applications where these features are crucial.

 SOAP APIs support more advanced functionalities such as RPC (Remote Procedure Call)
and messaging standards like WS-Security.

3. GraphQL (Graph Query Language)


 Query Language: Clients define the structure of the response, asking for exactly
what they need.
 Single Endpoint: All interactions happen through a single endpoint.
 Strong Typing: Schema defines types and relationships between types.
 Advantages:
 Efficiency: Reduces over-fetching and under-fetching by allowing clients to request
exactly what they need.
 Flexibility: Clients can evolve independently of servers.
 Self-Documenting: The schema and types serve as documentation.
 Disadvantages:
 Complexity: Requires a more complex setup and understanding.
 Caching: More challenging to implement traditional caching mechanisms compared
to REST.
 Overhead: Initial performance can be lower due to the need to parse and validate
queries.
 Use Cases:

 Applications with complex relationships and data requirements, such as social


networks.
 Mobile applications where bandwidth efficiency is crucial.

Feature/
Aspect REST API SOAP API GraphQL
XML-based, transport
Protocol HTTP agnostic (HTTP, SMTP) HTTP
Architecture
Style Resource-based Protocol-based Query language
Data Format JSON, XML, HTML, etc. XML JSON
Endpoint Multiple endpoints (one Single endpoint for all
Structure per resource) operations Single endpoint
HTTP methods (GET, POST, Specific operations
Operations PUT, DELETE) defined in WSDL Queries and mutations
Can be stateless or
Stateless Yes stateful Yes
Standardized SOAP fault
Error Handling HTTP status codes messages Custom error handling
Security OAuth, JWT, SSL/TLS WS-Security, SSL/TLS OAuth, JWT, SSL/TLS
Easy to implement HTTP More complex, less Challenging, custom
Caching caching common solutions needed
Documentatio Self-documenting via
n Swagger/OpenAPI, RAML WSDL schema
Simple, easy to Complex, steep learning Moderate, requires
Ease of Use understand curve understanding schema
Higher overhead due to Efficient, but initial
Performance Efficient, less overhead XML and envelopes overhead
CRUD operations, simple Enterprise applications, Complex queries, mobile
Use Cases services complex transactions apps, social networks
Scalability, simplicity, Reliability, formal Efficiency, flexibility,
Advantages flexibility contracts, extensibility reduced data transfer
Over-fetching/under- Complexity, performance
Disadvantages fetching overhead Complexity, caching issues

You might also like