API / Web Services - Interview Questions.

 


API / Web Services - Basics


What is web Service? Explain with an example?

Web service is a standardized communication medium between the client and server applications on the World Wide Web.

For example :- when we started searching anything on the google it will invoke different type of services like.. Search for the resources, getting the results from multiple websites, spelling check, fetch cache etc.

another example will be like if i want to show the temperature of the current city, instead of writing the logic to get the temperature of the city i can simply invoke API's which can help me with this feature.  

In simple words..

Web Services are the services which is can be written by anyone else and we can just pass our input and get the output from that service.

It means we really don't need to know how exactly it is giving us the output but we are getting the desired output based on our input values.

A web service is a software module that is designed to perform a certain set of tasks. 

API terminologies

Get :- Get action tells the system/ module that you want to fetch or retrieve the information. 

Post :- With post api generally we create a new object and receive response code as 201, in case of successful completion of the object. 

Put :- It is same as post, but it worked for the existing object, so we need some existing parameters and stuff/ change/updated values to work on that object also PUT is for complete entity replacement whereas PATCH is to partially update the entity.

Delete : Delete action just ask server to delete an existing object.

Patch :- Patch request says that we would only send the data that we need to modify without modifying or effecting other parts of the data. Ex: if we need to update only the first name, we pass only the first name also PUT is for complete entity replacement whereas PATCH is to partially update the entity.

Idempotency :- A action that will always results in the same server state, no matter how many times we call it is known as idempotency.

Type of API's 

REST ( Representational State Transfer)

SOAP ( Simple Object Access Protocol )

Risk with API's

API structure keep on changing   change

API logic change (any bugs )

response structure change


API / Web Services - Interview Questions.

Question :- Suppose I have a service which return schedule flights available based on input parameters. Can you tell me how would you test this service ? All possible test scenarios?

Ans :- i can think of below mention test scenarios.

Search Flight Names - API to get all the flight Name available in the system

Search Flight Names based on the date - API to get all the flight Name available in the system based on the selected date.

Search Flight Names based on airports - API to get all the flight Name available in the system based on the airports.

Search Flight Names based on timings - API to get all the flight Name available in the system based on the timings.

Search Flight Names based on price filter- API to get all the flight Name available in the system based on the price filters.

Search Flight Names based on flight cancellation options- API to get all the flight Name available in the system based on flight cancellation options







Post a Comment