Skip to main content

Rest API Interview Question & Answers -Recently asked 2021

 1) Explain what is REST and RESTFUL?

REST represents Representational State Transfer; it is a relatively new aspect of writing web API.

RESTFUL is referred for web services written by applying REST architectural concept are called RESTful services, it focuses on system resources and how state of resource should be transported over HTTP protocol to different clients written in different language. In RESTFUL web service HTTP methods like GET, POST, PUT and DELETE can be used to perform CRUD operations.

2) Explain the architectural style for creating web API?

The architectural style for creating web api are

  • HTTP for client server communication
  • XML/JSON as formatting language
  • Simple URI as the address for the services
  • Stateless communication

3) Mention what tools are required to test your web API?

SOAPUI tool for SOAP WS and Firefox "poster" plugin for RESTFUL services.

4) Mention what are the HTTP methods supported by REST?

HTTP methods supported by REST are:

  • GET: It requests a resource at the request URL. It should not contain a request body as it will be discarded. Maybe it can be cached locally or on the server.
  • POST: It submits information to the service for processing; it should typically return the modified or new resource
  • PUT: At the request URL it update the resource
  • DELETE: At the request URL it removes the resource
  • OPTIONS: It indicates which techniques are supported
  • HEAD: About the request URL it returns meta information

5) Mention whether you can use GET request instead of PUT to create a resource?

No, you are not supposed to use PUT for GET. GET operations should only have view rights, while PUT resource is used for updating a data.

6) Mention what are resources in a REST architecture?

Resources are identified by logical URLs; it is the key element of a RESTful design. Unlike, SOAP web services in REST, you view the product data as a resource and this resource should contain all the required information.

7) Mention what is the difference between PUT and POST?

"PUT" puts a file or resource at a particular URI and exactly at that URI. If there is already a file or resource at that URI, PUT changes that file or resource. If there is no resource or file there, PUT makes one

POST sends data to a particular URI and expects the resource at that URI to deal with the request. The web server at this point can decide what to do with the data in the context of specified resource

PUT is idempotent meaning, invoking it any number of times will not have an impact on resources.

However, POST is not idempotent, meaning if you invoke POST multiple times it keeps creating more resources


8.) Mention which markup language can be used in restful web api?

JSON and XML are the two markup language that can be used in restful web api

9) Mention what is JAX-WS and JAX-RS?

Both JAX-WS and JAX-RS are libraries (APIs) for doing communication in various ways in Java. JAX-WS is a library that can be used to do SOAP communication in JAVA, and JAX-RS lets you do the REST communication in JAVA.

10) List out the tools or API for developing or testing web api?

Testing tools for web services for REST APIs includes

  • Spring REST web service using MVC
  • Jersey API
  • CXF
  • Axis
  • Restlet,

11) Mention what is the difference between SOAP and REST?

SOAP

REST

  • SOAP is a protocol through which two computer communicates by sharing XML document
  • SOAP permits only XML
  • SOAP based reads cannot be cached
  • SOAP is like custom desktop application, closely connected to the server
  • SOAP is slower than REST
  • It runs on HTTP but envelopes the message
  • Rest is a service architecture and design for network-based software architectures
  • REST supports many different data formats
  • REST reads can be cached
  • A REST client is more like a browser; it knows how to standardized methods and an application has to fit inside it
  • REST is faster than SOAP
  • It uses the HTTP headers to hold meta information


Comments

  1. Useful information for interview in simple way. Thx @Java Interview Goal

    ReplyDelete

Post a Comment

Popular posts from this blog

IPL 2025: The Ultimate Season Preview, Stats, and Predictions

 The Indian Premier League (IPL) 2025 is set to be bigger and better than ever. With a mega auction, new regulations, and rising superstars, this season is shaping up to be the most thrilling edition in IPL history. Let’s dive deep into team analyses, key player stats, historic milestones, and predictions to see what IPL 2025 has in store! IPL 2025 at a Glance Start Date: March 22, 2025 Final Match Venue: Eden Gardens, Kolkata Total Matches: 74 Teams: 10 New Rule: Introduction of 'Power Boost Over' (Allows a team to add an extra over to Powerplay if all wickets are intact by the 8th over) --- Interesting IPL 2025 Data & Records 1. The ₹100 Crore Auction - Highest Spending in IPL History Total Money Spent: ₹1050 crore (~$125 million) Most Expensive Player: Rishabh Pant (Lucknow Super Giants) - ₹27 crore Shreyas Iyer (Punjab Kings) - ₹26.75 crore Trent Boult (Delhi Capitals) - ₹18.5 crore 2. The ‘Orange Cap’ Race - Run-Scoring Machines Predicting the top contenders for the hi...

Java 24 Released: What's New and Why It Matters?

 Oracle has officially released Java 24 on March 18, 2025, bringing a host of new features aimed at improving developer productivity, security, and performance. This release includes over 20 enhancements, making Java even more powerful for modern application development. Let’s dive into the key features and improvements in Java 24 and understand why they matter. --- 1. AI and Machine Learning Support Java 24 introduces features designed to enhance AI-powered applications. Developers can now integrate AI models and perform AI inference more efficiently using built-in Java capabilities. Why It Matters? With AI becoming a crucial part of modern applications, Java 24 makes it easier to process and deploy AI models without relying heavily on third-party libraries. --- 2. Post-Quantum Cryptography To prepare for the future threats of quantum computing, Java 24 includes new cryptographic algorithms that protect against potential security breaches. Why It Matters? Quantum computers could p...

The Mysterious Journey of Astronaut Sunita Villms: A Struggle Between Earth and the Unknown

 Astronaut Sunita Williams and her colleague, Barry "Butch" Wilmore, recently returned to Earth after an unexpected nine-month mission aboard the International Space Station (ISS). Originally scheduled for a brief eight-day stay, their mission was extended due to technical issues with the Boeing Starliner spacecraft, leading to a prolonged 286-day duration in space.  Mission Extension and Challenges The mission's extension was primarily due to propulsion problems with the Starliner craft, necessitating their continued presence on the ISS. This unforeseen prolongation presented both physical and psychological challenges for the astronauts. Prolonged exposure to microgravity can lead to muscle atrophy, bone density loss, and other health concerns. To mitigate these effects, astronauts adhere to rigorous exercise regimens while aboard the station.  Health Observations Upon Return Upon their return, noticeable physical changes were observed, particularly with Sunita Williams,...