What is an API ?

An API stands for Application Programming Interface. It's essentially a set of rules and protocols that allows different software applications to communicate with each other. Imagine it as a waiter in a restaurant. You (the application) tell the waiter (API) what you want, and the waiter communicates your request to the kitchen (server). The kitchen prepares your food (the data), and the waiter brings it back to you. 


What are main differences between API and Web Service? 

APIs and web services both enable communication between software applications, but they are not the same. Here are the main differences:


What is API Testing?

API Testing is the process of evaluating an API to ensure it functions correctly, reliably, securely, and performs well. It involves checking if the API returns the expected results, handles errors gracefully, and meets performance standards. API testing helps identify issues and ensures smooth communication between software applications. 


What are the advantages of API Testing?

API Testing offers several significant advantages:


What are common API protocols

There are several common protocols used in APIs to enable communication between different software systems. Here are some of the most widely used ones:


What are principles of an API test design?

 The five most important principles of an API test design are:

 Setup: Create objects, start services, initialize data, etc

 Execution: Steps to apply API or the scenario, including logging 

Verification: Oracles to evaluate the result of the execution 

Reporting: Pass, failed or blocked 

Clean up: Pre-test stat 


What are the common API testing types?

 While there are certainly specialty tests, and no list can be asked to be comprehensive in this realm, most tests fit broadly into these following nine categories that you should remember before attending in an API testing interview. 

1. Validation Testing

 2. Functional Testing

 3. UI testing 

4. Load testing 

5. Runtime/ Error Detection

 6. Security testing 

7. Penetration testing 

8. Fuzz testing 

9. Interoperability and

10. WS Compliance testing 


What must be checked when performing API testing? 

During the API testing process, a request is raised to the API with the known data. This way you can analyze the validation response. While testing an API, you should consider:

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,

8. Non-functional testing like performance and security testing 



What is REST?

REST stands for Representational State Transfer. It is an architectural style for designing networked applications and is often used for building web services. Here are the key principles of REST:


What is SOAP

SOAP stands for Simple Object Access Protocol. It is a protocol for exchanging structured information in the implementation of web services. Here are some key features and characteristics of SOAP:

SOAP is often used in enterprise environments where reliability, security, and interoperability are critical. It is well-suited for complex transactions and scenarios that require robust messaging capabilities.


What are the differences between SOAP and REST?

SOAP and REST are two popular approaches for building web services, but they have some key differences:

In summary, SOAP is a protocol with strict standards, making it suitable for complex and secure transactions. REST is an architectural style that is more flexible, lightweight, and better suited for web and mobile applications.


What is a HTTP Response?

HTTP (Hypertext Transfer Protocol) response is a message sent by a server to a client, typically a web browser, in response to an HTTP request made by the client. The response contains information about the status of the request and may also include the requested data.

An HTTP response consists of three main parts:

HTTP/1.1 200 OK

Date: Fri, 30 Jun 2017 13:50:11 GMT

Connection: close

Content-Type: application/json


{

    "projects": {

        "project": [

            {

                "id": 1,

                "name": "A New Project",

                "position": 0,

                "state": "active"

            }

        ]

    }

}


The status code "200 OK" indicates that the request was successful, and the body contains a JSON payload with the project information


What is a HTTP Status code?

An HTTP status code is a three-digit number that the server sends back in response to an HTTP request made by a client (such as a web browser). It indicates the status of the request and whether it was successful, encountered an error, or requires additional action. Here’s a quick rundown of the main categories and some common status codes:


What is JSON

JSON (JavaScript Object Notation) is a lightweight data-interchange format that is easy for humans to read and write and easy for machines to parse and generate. It is based on a subset of JavaScript and is commonly used to transmit data between a server and a web application.

JSON represents data as key-value pairs, where each key is a string, and the value can be a string, number, boolean, null, array, or another JSON object. Here's an example of a JSON object:

{

  "name": "John Doe",

  "age": 30,

  "isStudent": false,

  "courses": ["Math", "Science", "History"],

  "address": {

    "street": "123 Main St",

    "city": "Anytown",

    "state": "CA"

  }

}


In this example:



What is XML

XML (Extensible Markup Language) is a versatile, human-readable and machine-readable text format used to structure data. It's similar to HTML but is designed to be both human- and machine-readable, allowing data to be stored and transported efficiently.

Here’s an example of an XML document:

<?xml version="1.0" encoding="UTF-8"?>

<note>

  <to>Jane</to>

  <from>John</from>

  <heading>Reminder</heading>

  <body>Don't forget our meeting tomorrow!</body>

</note>


In this example:


Key Features of XML:



What are HTTP Headers

HTTP headers are pieces of metadata sent along with an HTTP request or response. They provide additional information about the request or response, such as content type, encoding, cookies, and more. Here's a rundown of the most important headers and their purposes:

Common HTTP Request Headers

Common HTTP Response Headers


Widely used HTTP methods

HTTP (HyperText Transfer Protocol) methods are used to define the actions that can be performed on resources in a web service. Here are the most widely used HTTP methods: