Top 100 Web API Interview Questions and Answers

Table of Contents

TOP WEB API INTERVIEW QUESTIONS AND ANSWERS:

 1. What is a Web API?

In naive words, Web API is a protocol that helps the users outside to access data by making a mere request to the server by the HTTP protocol. So, we can state that Web API is an exchange of data to some extent. That too is allowed if and only if one obeys all the protocols made. 

 2. What is the use of Web API?

It allows one to access the data services of pre-built websites by using API keys and queries.

 3. Which protocol does Web API support?

It supports only HTTP protocol.

 4. Assets of Web API?

  1. Much easier to use and work with,
  2. Enables routing,
  3. Filters used in Web APIs tackle logging, protest handling, performance estimation, authentication, and permission.
  4. Content Negotiation helps increase user experience.
  5. It is open to self-hosting which reduces the maintenance requirements and makes it independent of IIS.

 5. Deprivations of Web API?

If the API you are trying to call is already hosted somewhere in the world, you may expect latency.

 6. Name a few web APIs of big labels?

Youtube API, Facebook API, Twitter API are few influential APIs from well-known brands. Some other significant Web APIs are Web audio API, Full-screen API, Channel messaging API.

 7. Which open-source library is utilized for JSON serialization by Web APIs?

For JSON serialization Json.NET library is used by Web APIs.

 8. Web APIs support which .NET framework?

For now, the Web API net framework supports NET 4.0 and above frameworks. 

 9. What do you know about Web API 2.0?

Web 2.0 is the latest version of the Web API, which includes new modern specialties. 

 10. What is the difference between Web API and Web API 2.0?

There is no such difference between these two. Web API 2.0 is just an extension in the old version of Web API that supports a few more features like AttributeRouting, OWIN self-host, IHttpActionResult, CORS, HttpRequestContext, Testability, ODATA Improvements, Filter Overrides, ByteRangeStreamContent, making it more productive.

 11. What is routing?

Web API provides help for parsing different URLs on a web page by handling all the HTTP requests and directly routes the request with the action. This process is called Web API routing. Web API routing routes the matching URLs to the matching routes from the routing table.

  12. What are the types of routing?

Currently, there are only two types of routing – 

Conventional Based – Conventional based routing requires you to add similar routes to the URLs. But there is a drawback that needs to be kept in mind while using conventional routing. That is, you need to arrange all the routes. First, more specified followed by less specified and similar paths in the Route Table.

Attribute-Based – Attribute-based routing is a new specialty in Web API routing 2.0, which uses attributes to set routes. It provides the user a good versatility while shifting to another URL.

 13. What do you understand about Web API versioning?

Web API versioning allows its clients to make a change or update the data. But this requires one to have permission to do so. To make changes in the data, the client needs to request the service provider.

And, this is possible with the help of Web API versioning using the URLs, queries, and headers without changing the existing API. Web API versioning helps to renew data over time. This probably helps to make a good connection between the client and server.

Web API Interview Questions and Answers

 14. Describe all the HTTP protocol methods used in Web API.

Web API mainly works on the four HTTP protocols, which we can also understand by the CRUD method Create, Read, Update and Delete. Here Create stands for POST, Read for getting, Update for PUT and Delete for DELETE. 

 15. What are different HTTP status codes?

HTTP status codes are the three-digit code that indicates the response of the server. 

  1. If one receives a status code in range 1XX, it indicates that the server has received the request, and the outcome is processed. 
  2. If the response is in range 2XX, it indicates that the request was successful and the server has accepted it. 
  3. If the response is in range 3XX, then the request has been redirected for further examining. 
  4. If the response is in range 4XX, then the client has made mistakes in making the request.
  5. And, if you receive a response in range 5XX, then there’s a problem from the server’s side in processing the information.
See also  Top 100 Jenkins Interview Questions and Answers

 16. Name tools for developing or testing web APIs.

  1. The Postman is one of the popular tools for building API and monitoring it. It is a user-friendly and free open-source application. It is excellent for the development of RESTful services.
  1. Fiddler is just another free application that enables you to perform different checks on the HTTP protocols and requests. And also create it.

 17. What is the Authorize attribute? Mention its uses.

Authorize Attributes maintains the security of the application by keeping a check on the authorized and unauthorized users. It helps us to keep the server secure by allowing only the authorized users.

We can also quash this attribute by using AllowAnonymous Attribute. If the user is unauthorized, the server returns the HTTP responses with the HTTP status code 4XX.

Uses of Authorize Attribute:

  1. It keeps the server safe and secure from unsafe external use.
  2. By restricting the entrance, only approved users can use it.

 18. What are REST and SOAP?

REST stands for REpresentational State Transfer, while SOAP stands for Simple Object Access Protocol. REST is a structural pattern used in performing web co-operations. If the HTTP protocol is successful, the service provider sends the data in HTML, plain XML, or JSON string.

On the contrary, SOAP only supports the XML format for sending messages or data. It is a messaging custom for sending the structured data to utilize it in the other web services.

 19. What is XML?

XML notions for Extensible Markup Language. It is composed as, which is both human and machine-readable. XML profoundly supports Unicode for almost all human languages. XML is extensively used in Service-oriented architecture (SOA) and is the default protocol format for SOAP.

 20. What is JSON?

JSON stands for the JavaScript Object Notation. It is a dictionary-type data format that is very similar to JavaScript. It is the most preferred format due to its extensive human readability. It is serviceable for transmitting less private data through internet services. 

TOP WEB API INTERVIEW QUESTIONS AND ANSWERS:

 21. How are XML and JSON distinct from each other?

XMLJSON
More SecureLess Secure
Supports namespacesDoes not support namespaces
Capable of displaying dataNo display capabilities
Only supports UTF-8Supports several Unicodes
Less readableMore readable

 22. Why is JSON more popular than XML?

JSON is very similar to JavaScript, which is one of the most powerful programming languages. And, JSON has proven to be more user-friendly than XML. Even though! XML is a much more powerful data format than JSON. But due to its ease and similarities with one of the powerful languages, it is more common than XML.

 23. What is ASP.NET Web API?

ASP.NET Web API is an open web interface framework used to build HTTP services for Web Application Programming Interface (Web API). Here ASP notions Active Server Pages. And ASP .NET Web API is just the modified and updated version of ASP. The ASP .NET API is used broadly for creating both RESTful and non-RESTful services.

 24. What is new in ASP.NET Web API 2.0?

Afresh features in ASP.NET Web API were introduced and, a new version that is ASP.NET Web API 2.0, came into the market to provide more flexibility to its users with the following new features:

  1. Net Self-hosting – This reduced the need for regular maintenance.
  2. Attribute routing – Uses attributes to set routes in the routing table.
  3. CORS: Cross-origin resource sharing – This allows sharing any other website whenever required.
  4. OData services extensions of $Select and $expand, here $Select allows to select a property. $expand to select relevant items.
  5. IHttpActionResult – Used to create an unauthorized type response by using ExecuteAsync.

 25. What are the assets of using REST?

The benefits of using REST is as follows:

  1. More user-friendly and versatile.
  2. Most suitable for using it on petite web services due to limited data transfer.
  3. Flexible data format.
  4. Avail protection by using OAuth protocols.

 26. What is WCF?

WCF notions Windows Communication Foundation. Formerly, it was identified as Indigo. It is applied to build Service-Oriented Applications(SOA). 

 27. Difference between Web API and WCF.

Web APIWCF
Supports only HTTP protocolSupports HTTP, SOAP, TCP, and UDP
Web API uses only UTF-8Offers several Encoding – Binary encoding, MTOM, and TEXT, etc.
Supports MVC Does not support MVC
Used for developing both SOAP & RESTful servicesOnly used for SOAP

 28. Ways to handle errors in Web API. 

There are several ways for supervising errors in a Web API. Few errors tackling processes are:

  1. HttpResponseException – Handles both the controller and action level exceptions and translates them into 500 internal server error responses.
  2. HttpError – CreateErrorResponse is used to create the HttpError method and, with this, one can generate meaningful error messages.
  3. Exception Filters – Used to handle unhandled exceptions.
  4. Exception Handlers – Used for customizing the exceptions raised.

 29. What is ASP.NET MVC?

It is a design prototype application that comprises a Model, View, and Controller. Thus, acknowledged as MVC. MVC makes things easier for coders by separating the components. ASP.NET MVC achieves this by displaying various arrangements between the original display and the data model.

 30. Difference between ASP.NET MVC and Web API.

ASP.NET MVCWeb API
Web applications made both replies as data and viewsWeb applications made only reply with data
Can’t build RESTful servicesExcellent platform for  building RESTful services web API
Returns JSON format Returns JSON format, XML format and BSON etc.
Does not provide any additional supportSupports self-hosting & content negotiation

TOP WEB API INTERVIEW QUESTIONS AND ANSWERS:

 31. What are the Web API filters? 

Filters allow us to set the desired result over any action done by the user. With the help of this, we can override the default return HTTPResponseMessages.

Filter used by Web API are:

  1. Auction Filter – Adds functionality to the Web API services.
  2. Authorization Filter – Checks the authentication of the clients, including browsers.
  3. Authorized Filter – Filters the authorized user and separates it.
  4. Authorize Attribute – Allows only authorized clients.
  5. Override Filter – Excludes the particular controllers and actions.
  6. Exception Filter –  Handles the unhandled filters.

 32. Is it the case that ASP.NET Web API has replaced WCF?

No, not at all, as both are different in their domains. If we compare Web API and WCF, there are many differences between them, making both stand out in their positions. WCF is specialized to develop only SOAP-based services. Whereas using ASP.NET Web API, we can build non-SOAP-based services like develop RESTful services. 

 33. What is HTTPConfiguration?

HTTPConfiguration is just a specific class of Web API. And, this class of Web API is helpful to overrule the default action of Web API.

Properties of HTTPConfiguration are as follows:

  1. DependencyResolver – Handles dependency injection.
  2. MessageHandlers – Decides and handles the message response.
  3. ParameterBindingRules – Set of rules for binding all the parameters.
  4. IncludeErrorDetailPolicy – Sets error messages.
  5. Formatters – Uses internet media-type compositions.
  6. Properties – Collects properties of the Web at the moment.
  7. Services – Acquires Web API services.
  8. Filters – Adds a filter to the requests.
  9. Routes – Collects the routes for the Web API.

 34. What do you understand about REST and RESTful?

REST stands for REpresentational State Transfer. REST is a structural pattern used in performing web co-operations. If the HTTP protocol is successful, the service provider sends data in JSON format, HTML, or XML format. If we talk about RESTful, it is the term practiced in the REST for web services it presents.

 35. Describe HTTP methods used by Web API?

HTTP methods used by Web API are as follows:

GET Used to procure data from the service provider.

POST – Used to append data to the service provider data by making a request.

PUT – Used to request the service provider for allowing updating data. 

DELETE – Used to delete the data. 

CONNECT – Used for establishing a connection to the service provider.

HEAD – Used to check the approachability, availability, volume, and last alteration date of a source without downloading it.

TRACE – Tracks the history of all the data, which further helps in debugging the arguments.

OPTIONS – Specifies the way of communication and objective for the destination source.

 36. Difference between Web API Controller and Controller.

APIControllerController
Used when to return serialized data onlyUsed to render normal views
Returns dataReturns action result
Cannot return viewCan return view

37. What is CORS?

Cross-origin resource sharing(CORS) is a method that allows sending requests from one website to another. It makes it more straightforward for one to pull data from other websites to any particular website. Overriding the Same Origin Policy(SOP) CORS helps its clients quickly relocate the data. From other websites without affecting the security of the website.

 38. Describe the types of parameters in REST API.

Parameters used to create requests in REST API are:

  1. Header parameter – Used for authorization.
  2. Query parameter – Helps to target peculiar content or operation.
  3. Request body parameter – Used to impart and acquire information.
  4. Template parameter – Used to parametrize the request path
  5. Matrix parameter – Added before the query string in the request path.
See also  Top 100 ASP.Net Interview Questions and Answers

 39. What is the difference between ASP.Net Web API and .Net core Web API?

ASP.Net Web API.Net core Web API
Ablest for building RESTful servicesUsed for developing web UI and web APIs.
The cross-platform net framework is not supportedSupports cross-platform net framework
Multiple web stackSingle aligned web stack

40. What is the use of HTTPResponseMessage?

HTTPResponseMessage allows us to keep track of the status of the request sent to the service provider. By which we can assume the events. It works on the HTTP protocols and returns the proper status code that is the HTTP response message making things easier for clients to understand. If the request sent was successfully admitted or renounced. 

TOP WEB API INTERVIEW QUESTIONS AND ANSWERS:

 41. What are the advantages of using ASP.NET Web API?

Advantages of using ASP.NET Web API:

  1. ASP.NET Web API supports all the MVC features, including routing, filter, and controllers.
  2. It is very light and easy to use.
  3. It is an ideal platform for building applications of Low Bandwidth.
  4. Most suitable to develop non-SOAP HTTP Based Services.
  5. Content negotiation and several drive support make it more convenient to use.

 42. What do you mean by Caching and, What are its types?

Caching is the method of depositing and transmitting the data into the software identified as Cache. We can understand Cache as a storeroom. Cache helps to run the processor comparatively fast by storing all the in an auxiliary location.

Types of Caching possible:

  1. In-memory caching – Stores data straight in RAM.
  2. Database caching – 
  3. Web client caching – Stores on the client-side and loads automatically when required, if not removed or deleted.
  4. Web server caching – Stores data in the server dynamically.
  5. CDN caching – Stores web pages, stylesheets, scripts, and media files, in proxy servers.

 43. What do you know about HTTPError exception filters?

HTTPError exception filters handle all the exceptions thrown while making the HTTP requests and are unhandled by other filters. Then these filters deal with all the filtered exceptions. 

 44. What is the use of DelegatingHandler?

A series of message handlers are chained together to respond to several HTTP requests in the server. And finally, at some point. The response is generated and is returned to the client back in the opposite direction.

And, this process of receiving the request and then returning the response to the client is known as Delegating handler.

 45. Explain the difference between REST API and Web API.

REST APIWeb API
Structural pattern Open-source framework
Supports HTTP, XML, JSON format, and URLOnly supports HTTP standards
Does not stores dataStores data
For every HTTP response, a new TCP connection is establishedUses single TCP connection
Slower in comparison to Web APIFaster than REST API

 46. Is it possible to use ASP.NET Web API in applications generated using other .NET languages?

Yeah, it is possible. We can use ASP.NET Web API in applications generated using other .NET languages. The only mandatory thing is that it needs to support the HTTP protocol.  

 47. Explain content negotiation in Web API.

Content negotiation defines the format of the response. To be sent back to the range of clients. And, this makes the Web API work more explicitly when used on different devices other than PC like mobile devices and tablets.  

 48. Describe the steps for executing Web API Versioning.

For Web API Versioning, you’ll need to follow these steps:

Step 1: URI 

  • Changes the URI with the help of Web API routing

Step 2: QueryString parameter 

  • Adds another query string to find the controller

Step 3: Custom Header parameter – 

  • Provides additional information 

Step 4: Accept Header parameter –

  • Defines the file format for the response data expected

 49. What do you know about Basic HTTP Authentication?

In the Basic HTTP Authentication, the user relinquishes the username and the password to the HTTP authorization request. And these passed-in values are further decoded. Later it is changed to a string by using an encoding, which helps in the easy authentication. 

 50. What do you know about Digest HTTP Authentication?

Digest authentication is very comparable to that of basic authentication. It uses the same protocol of taking the username and password and then generating a unique key and sending a request to the server. But, before sending the information over to the internet. It applies a hash over the username and password of the client, which makes it more secure to lean on.

TOP WEB API INTERVIEW QUESTIONS AND ANSWERS: 

51. What is the difference between Basic HTTP Authentication and Digest HTTP Authentication?

Basic HTTP AuthenticationDigest HTTP Authentication
Less secureMore secure
Uses Base64 encodingUses hashing
Easy to implement Little tedious to work with

52. What is OData?

Here, OData notions Open Data Protocol. It provides a uniform way to set and administer all the CRUD operations effectively. It allows the creation of REST APIs and consumption of REST APIs. And, this additionally helps its users to edit resources using the authorized methods. ODATA first came into existence in the year 2007 by Microsoft Team.

 53. What is the difference between Web services and Web API?

Web ServicesWeb API
Accessed through a network connectionOne communicates with another
Supports XML onlySupports both XML and JSON
All webservices are APIAPIs are not webservices
Not open-sourceOpen-source

 54. What is Okobjectresult?

Okobjectresult executes the content negotiation and formats the response body and returns the 2XX response after completion.

 55. Describe Types of Web APIs.

Total four main types of Web APIs are known. And, these are as follows:

  1. Open APIs – Openly available for all to use.
  2. Partner APIs – Not publicly available and requires one to have access to that particular API.
  3. Internal APIs – These are private APIs that are created and used by any particular group or organization. 
  4. Composite APIs – These types of APIs are the union of multiple other APIs. And are practiced to boost up the speed of execution and operation.

 56. How to keep Web API secured?

To keep Web API secured, you can opt for these three ways:

  1. HMAC authentication: In HMAC authentication, the service provider processes a unique API key and a Secret Key to its client. And, with the help of those authorization keys, one can call the API. It will generate a hash HMAC signature. Now, by using both the parameters, one can request the server. The same method will take place on the end of the server. And, if both the HMAC signatures matched, then the authorization will be successful.
  1. Digital Signature: This method works by covering the message with a secret key generated by the security signature. Now the client will send this private key to the server. Each request will now get signed by the private key, so the server can undoubtedly authorize the request. This signature key must be kept confidential by the owner to avoid any controversy.
  1. OAuth: OAuth is one of the most used methods practiced for protecting the security of Web APIs. In this, the users need to log in to the services of the server. And after successfully logging in, the user is provided with a unique auth key that they can use to make requests to the server.

 57. Assets of using REST in Web API.

  1. It is very lightweight and able to develop Web-based services effectively.
  2. Limited data transfer is allowed.
  3. The confined data transfer makes it more compatible to use in mobile devices.
  4. Beginner-friendly.

 58. How to restrict Web API to any specific HTTP verbs?

To do so, you’ll need to define the HTTP verbs as a separate attribute to restrict access.

 59. Describe RESTful services?

It is a web service that uses REST. REST is a structural pattern used in performing web co-operations. If the HTTP protocol is successful, the service provider sends data in JSON format, HTML, or XML format. It is very lightweight and able to develop Web-based services.

 60. What is API testing?

API testing includes the testing of Application Programming Interfaces. It checks if the API satisfies all the required demands and if working correctly. API testing includes testing the performance, security, and functionality of the API.

 61. Name the types of API testing.

There exist several types of API testing. They are:

  1. Unit testing  
  2. Functional testing 
  3. Run time error detection 
  4. Security testing 
  5. Web UI testing 
  6. Penetration testing 
  7. Fuzz-testing 
  8. Interoperability testing 
  9. WS-* Compliance testing load testing 

 62. What is API Monitoring?

API monitoring is the testing process of performance, security, availability, and functionality of the API.

 63. What is RapidAPI testing?

RapidAPI testing is a testing tool that allows one to do comprehensive tests. With RapidAPI testing, you can do tests over REST APIs, SOAP, Web APIs, GraphQL APIs, or any API. It enables API monitoring, effortlessly increases web service performance web services, and allows extensive testing.

 64. What is the difference between REST and RESTful API?

RESTRESTful
REST is a structural pattern used in performing web co-operationsRESTful is a web service that uses REST
Supports HTTP format Supports HTTP, plain XML or JSON, and text
Works on request and responseWorks on services provided by REST

65. What are the main return types in Web API?

The main return types that Web API supports are:

  1. Void – Here, Void means the invalid status code. Web API returns void when the content is empty.
  2. Primitive type and complex type – Helps you write serialized data in the return body.
  3. HTTPResponseMessage – Converts the response to the HTTPResponseMessage and sends it to the user.
  4. IHTTPActionResult – 
See also  Top 65 Apache Kafka Interview Questions And Answers

 66. What is URI?

URI notions Uniform Resources Identifier. URI work is to locate different resources by their identities and, with the help of routed URLs, it loads them on the Web server. And, this allows its consumers to access the resources more quickly and in a simple manner.

 67. What are Internet Media Types?

Formerly it was known as Mime Types or as Content Types. With the name content types, we can understand very clearly that Internet media types determine the type of data contained in the data file. It represents both the type and the subtype of the data file.

 68. What is the OWIN open web interface for .NET?

OWIN notions Open Web Interface for .NET. It is an open-source interface for the .NET self. It defines a standard interface between ASP.NET web applications and the web servers. OWIN helps in unlinking the server and the application, making it compatible with ASP.NET and IIS. Although, doing this is not an easy job. But with the OWIN, we can do this in a manageable way. OWIN uses Appfunc to communicate with other service providers.

 69. What is Katana OWIN?

Katana is used to develop and host OWIN based web applications. One can also define Katana as the more advanced version of OWIN. It is an open-source project, which is available for all to use.

Katana was formulated by the Microsoft Team using the segments of OWIN.

 70. Elaborate Parameter binding in ASP.NET Web API.

Parameter binding in ASP.NET Web API binds the HTTP requests and parameters sent by the client to the server. There could be different types of query strings in the request made by the client. Parameter binding defines how all these HTTP requests, along with parameters to be bound.

TOP WEB API INTERVIEW QUESTIONS AND ANSWERS:

 71. What is a TDD – Test data-driven approach?

TDD stands for Test data-driven. It is a development tool. In this, the developer first writes the test cases and tests those cases if they work fine. If not, then the developer looks into the code fixes it. And then again runs tests on it. And these steps are repeated again and again. Till the code does not passes all the tests.

 72. What is ATDD?

Here, ATDD notions Acceptance test data-driven, which is also known as Behavioral driven development. It focuses on the overall functioning of the system.  In this, an individual acceptance test, written to fulfill all the functionalities required by the system, is used to perform tests over the code.

 73. How to return JSON rather than XML regardless of the Accept Header?

To achieve this, you will require to remove the XmlFormatter from the Register() section of the WebApiConfig.cs configuration file in the App_Start folder. Now to remove XmlFormatter, you need to include the following lines of code in the configuration file. 

config.Formatters.Remove(config.Formatters.XmlFormatter)

With this, regardless of what was defined. Overriding the values from the accept header web will return the data in the XML format only.

 74. How to return XML rather than JSON regardless of the Accept Header?

To achieve this, you will require to remove the JsonFormatter from the Register() section of the WebApiConfig.cs configuration file in the App_Start folder. Now to remove JsonFormatter, you need to include the following lines of code in the configuration file. 

config.Formatters.Remove(config.Formatters.JsonFormatter)

With this, regardless of what was defined. Overriding the values from the accept header web will return the data in the JSON format only.

 75. What are the REST constraints?

  1. Client and Server Constraint – Specifies that the client will send a request to the server, and then the server will respond to that request.
  1. Stateless Constraint – It specifies that the communication between the client and the server is encrypted. And no data of the client is stored anywhere on the server-side.
  1. Cacheable Constraint – Cacheable constraint commands the server to send all the data in the cacheable form. So that client need not be required to request data for particular item data dozens of times.  
  1. Uniform Interface Constraint – This constraint expresses that the interface for the client, regardless of which device they are using, must give the similar and uniform interface 
  1. Layered System – It helps increase proficiency and reduces the functioning load by distributing the caches with each layer.

 76. Is there any limit for using an API?

It depends on the API provider. A few provide their services for free. And, a few may ask you to pay for using it boundlessly. But, the one providing it for free may bound you with some limitations in using their API services.

 77. What is the resource in REST?

A resource includes all the content on the web page. Including HTML pages, Images, Texts, Videos, and all the data present on it. One needs to request the server to get access to these resources. And, if the service provider approves the request, we get hold of all the content or resources.

 78. What is the payload in RESTful services?

Payload is the data that an individual wants from the service provider. The HTTP body includes tons of other pieces of information in which the user may not be interested. So, here payload helps to distinguish between the required data and the unimportant data.

 79. What are the characteristics of SOAP?

  1. Omits firewall problems while using HTTP protocols.
  2. Uses XML format for sending responses and status messages.
  3. Independent and easy to use.
  4. Ablest for transporting data in a decentralized environment.

 80. Difference between SOAP and REST.

SOAPREST
It is a protocolIt is a structural pattern 
Supports only XML formatSupports HTTP, XML, data in JSON format, and URL
Comparatively SlowerComparatively Faster
SOAP cannot use REST servicesREST can use SOAP services

TOP WEB API INTERVIEW QUESTIONS AND ANSWERS:

 81. What are the deprivations of using SOAP?

  1. Slower than other available services.
  2. Support different programming languages that make it inconsistent with its performance.
  3. Only one consumer can use the SOAP services at a time.

 82. What is a protocol?

It is the collection of customs obeyed to process and deploy data. It defines the syntaxes to be used, data flow, data type, and management of the administrator. A system of administrators is established, with clusters of protocols. With which two ends can communicate with each other in the same speech.

 83. Difference between POST and PUT methods?

POSTPUT
Used to insert new dataUsed to update the existing data
POST is not cacheablePUT is cacheable
It is not idempotentIt is idempotent

84. Why is it preferred to use Web API over WCF?

It is preferred to use Web API over WCF, due to the following advantages:

  1. Provides much faster and lightweight service
  2. Supports multiple data formats
  3. Carries full features of HTTP
  4. Web API uses SOAP-based protocols, while WCF uses non-SOAP-based services
  5. Accessible by a range of clients

 85. What are the principles of API testing?

  1. Set-up the environment: Produce entity, set up conveniences, and split up data
  2. Execution: Footstep to apply the framework comprised logging
  3. Verification: Check if the authorization works properly
  4. Reporting: Report the Progress, malfunction, and bugs found
  5. Clean up: Examine the state

 86. What are the tests done in API testing?

  • Discovery testing
  • Usability testing
  • Security testing 
  • Automated testing
  • Documentation testing 

 87. Describe steps for performing API testing.

  1. Firstly understand the commitment of API.
  2. Create an approach list.
  3. Apply suitable techniques.
  4. Insert parameters according to the requirement.
  5. Now test different cases and note the outputs.
  6. Match outputs with the expected result.

 88. What is unit testing?

Unit testing is a testing strategy that examines the code before and makes sure if the code is operating correctly without any bugs. In this test cases are formulated for all the functions so we can easily track the fault caused by the change.

 89. Difference between API testing and unit testing.

API TestingUnit Testing
Done by the testerDone by the developer
UI testing is not doneUI testing is done
All functionalities are checkedBasic functionalities are tested
Tested before check-inTested after building

 90. What are the common bugs found in API testing?

The common bugs found in API testing are:

  • Unused flags
  • Less reliability
  • Security Problems
  • Performance Issues. 
  • Multithreading problems
  • Missing or redo functionality
  • API response time is very high
  • Response Data is not structured rightly
  • The incorrect approach of valid arguments
  • Complexity in connecting and getting a response
  • Collapses to control error conditions appropriately

TOP WEB API INTERVIEW QUESTIONS AND ANSWERS:

 91. Who can use APIs?

It is for all. Anyone can use it. And, modified APIs have made it available almost for all to use. There’s a lot of APIs available in the industry. One can use any of the APIs unless it is insular to a group or organization.

 92. How is HTTP connectionless? Explain.

Once the client successfully makes its requests, the client gets disconnected from the server. And the request gets processed by the server back to the client. In this whole process, at no point, the client and the server are connected. It defines that HTTP is connectionless. And the server is partially attached to the client directly.

 93. Explain HTTP as media Independent

HTTP is independent of any data or media type unless both the client and the server know to handle the data type forwarded to each other. And so, the client is requested to specify the type of media before making the request.

 94. What is WCF REST?

Windows Communication Foundation WCF Rest uses the full features of HTTP. It also supports all the MVC features that make it more simple and robust. WCF is basically used to build Service-Oriented Applications(SOA).

 95. What are the advantages of unit testing?

Advantages of unit testing:

  1. Provides easy documentation for getting started
  2. Help fix code comparatively faster
  3. Save your precious time
  4. Reduces bug repairing cost
  5. Make debugging process easier

 96. What are the things that must be checked while API testing?

  • Data efficiency
  • Authorization
  • Completion
  • Validation

97. What is an APIBuilder?

APIBuilder is a bundle of modules and classes that help one to implement the RESTful APIs. This helps the consumer to handily build an API of their own without getting into the coding part. And, for this, there are lots of free API builders available for consumer use without any cost. 

98. Explain components of API builder.

The two pillars of API builder are:

APIBuilder – Help in the easy construction of the API URLs.

APIService – This contains the heart of the API. The HTTP services for the client – GET, POST, and PUT methods.

99. What Is AJAX?

AJAX notions Asynchronous JavaScript and XML. We can call it a tool consisting of a lot of different programming kits to cultivate impressive web applications with less labor. AJAX is responsible for the background conversation between the client and the web servers. It uses synchronized requests to transmit information.

Once the process gets initiated, JavaScript generates XMLHttpRequest whose work is to transfer the data in the XML format to the servers. This process is hidden from the user.

So, the user will not get to know if any process is happening behind the scenes. Now, once the procedure completes, content on the screen automatically gets updated for the user.

100. What is API Endpoint?

API Endpoint is the place where all the requests and responses are channeled between the client and the server. It is the major part of any API as this is the point where the user can go and ask the server for any sort of data.

Recommended Articles