0% found this document useful (0 votes)
14 views

API Content

dfgd

Uploaded by

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

API Content

dfgd

Uploaded by

Sudarshan Shinde
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

1. What is an API?

An API (Application Programming Interface) is a software intermediary that


enables two applications to communicate with each other.
Eg. Google Maps API, Amazon Advertising API, Twitter API, YouTube API, etc.

What are main differences between API and Web Service?

• All Web services are APIs but not all APIs are Web services.

• A Web service always needs a network to operate while APIs don’t need a
network for operation. API’s can be tested on local machine

What is API Testing?

API testing is a kind of software testing which determines if the developed APIs
meet expectations regarding the functionality, reliability, performance, and
security of the application.

What is the procedure to perform API testing and what exactly needs to be
checked?

During the API testing process, a request is raised to the API with the known
data. This way you can analyze the validation response. Basically, things that
must be checked during performing API testing are:

1. Accuracy of data
2. Schema validation
3. HTTP status codes
4. Data type, validations, order, and completeness
5. Authorization checks
6. Implementation of response timeout
7. Error codes in case API returns, and
8. Non-functional testing like performance and security testing
Name the common protocols used in API testing.

Many protocols are there that can be used in API testing. These are as follows:

JMS, REST, HTTP, UDDI, and SOAP

Name different tools used for API testing.

There are many testing tools available that can be used for API testing. A few
of them are:

Postman, SoapUi Pro, Curl, and Alert site API monitoring

What is REST API?

REST API is a set of functions helping developers in performing requests along


with receiving responses. Through HTTP protocol interaction is made in REST
API.

The term REST refers to Representational State Transfer. In a very short span
of time, it has become an effective standard for API creation.

What is SOAP?

The term SOAP refers to Simple Object Access Control. In simple terms, it is
an XML-based protocol that helps in exchanging information among
computers.

What are the differences between SOAP and REST API?

SOAP REST

1. SOAP is a protocol through which two 1. Rest is a service architecture and


computers communicates by sharing XML design for network-based software
document. architecture.

2. It supports many different data


2. SOAP supports the only XML format. formats.

3. SOAP is slower than REST. 3. It is faster than SOAP.


What are the commonly used HTTP methods for RESTful services?

• GET - Retrieves data from a server at the specified resource.


• HEAD - Works the same as the GET method, but the server replies
without the body.
• POST- Creates a new resource
• PATCH - Allows partial modifications to a resource
• PUT - Replaces all current representations of the target resource
• DELETE - Removes the defined resource

What’s the difference between PUT and POST operations in Rest API?
PUT POST

The PUT method is a call when you have to modify


POST method is a call when you have to add a
a single resource, which is part of resource
child resource under resource collection.
collection.

PUT for UPDATE operations. POST for CREATE operations.

If the PUT request is used more than one time, If a POST request is used multiple times, the
the results will remain the same. results will be different.

Can we use GET requests instead of PUT to create a resource?

PUT or POST are used for creating resources. GET is used only for requesting
data from a specified resource

Can we use POST instead of PUT to create a resource?

Yes, we can because POST is the superset of all HTTP requests except GET
requests.
Explain the major challenges that come while API testing.

The list of major challenges that come while API testing is:

1. Parameter Combination
2. Parameter Selection and
3. Call Sequencing

Explain the types of bugs that can be found using API testing?

API is capable of finding many types of bugs that includes:

1. Stress
2. Security
3. Duplicate or missing functionality
4. Reliability
5. Unused flags
6. Incompatible error handling
7. Multi-threaded issues, and
8. Improper errors

List some templates for API documentation that are most used.

There are various API documentation templates that are making the whole
process really simple and easy. Check them below:

1. Swagger
2. Miredot
3. Slate
4. FlatDoc
5. API blueprint
6. RestDoc
7. Web service API specification
What are differences between API Testing and Unit Testing?

State the common status code you encounter in API testing.


200 (OK) Defines that the request was correct.

201 (Created) The value wrapped with the request has been created in the
database.

204(No Content) This status code means that the request was correct and
received but there is no response to send to the client by the server.

400 (Bad Request) A bad request means that the syntax of the request was
incorrect. It can happen if you have sent the wrong parameters along with the
request URL or in the body of the request.

401 (Authorized) We can incur such a status code when you are not
authorized to access the server or you have entered the wrong credentials.

404 (Not Found) A response code 404 means that the server was connected
but it could not find what was requested. You can normally see this status code
when you request a web page that is not available.
500(Internal Server Error) A response code 500 means there was some
exception at the server level while executing the request.

502(Bad Gateway) The server, while acting as a gateway or proxy, received an


invalid response from the upstream server it accessed in attempting to fulfill
the request.

503(Service Unavailable) The server is currently unable to handle the request


due to a temporary overloading or maintenance of the server.

504(Gateway Timeout) The server, while acting as a gateway or proxy, did not
receive a timely response from the upstream server specified by the URI

What is the difference between authorization and authentication?


• Authentication is a process of presenting your credentials to the system and
then the system validates your credentials. These credentials tell the system
about who you are.
• Authorization is a process of allowing or denying someone from accessing
something once authentication is completed.

Which is the most popular way to represent a resource in REST?

JSON is the most popular and important way to represent resources.

Define what is a URI?

Uniform Resource Identifier, URI consists of base URL, path parameter, and
query parameter

URI= Base URL + Path Parameter + Query Parameter


Example:

URI- https://reqres.in/api/users?page=2
HTTP defines these standard status codes that can be used to convey the
results of a client’s request. The status codes are divided into the five
categories.

• 1xx: Informational – Communicates transfer protocol-level information.


• 2xx: Success – Indicates that the client’s request was accepted
successfully.
• 3xx: Redirection – Indicates that the client must take some additional
action in order to complete their request.
• 4xx: Client Error – This category of error status codes points the finger at
clients.
• 5xx: Server Error – The server takes responsibility for these error status
codes.\

For more details please refer to the link

API Status Codes - Getting Started - API Docs - BigCommerce Dev Center -
Theme Development & API Documentation

You might also like