Web API Interview Questions and Answers
Ques 26. What is the purpose of the '429 Too Many Requests' HTTP status code?
The '429 Too Many Requests' status code indicates that the user has sent too many requests in a given amount of time. It is used to prevent abuse and ensure fair usage of the API.
Ques 27. Explain the role of content-type and accept headers in HTTP requests and responses.
The 'Content-Type' header in requests specifies the media type of the request payload, while the 'Accept' header in requests indicates the media types that are acceptable for the response. These headers play a crucial role in content negotiation between the client and server.
Ques 28. What is the purpose of the '401 Unauthorized' HTTP status code?
The '401 Unauthorized' status code indicates that the request has not been applied because it lacks valid authentication credentials. It is commonly used when a user needs to authenticate to access a protected resource.
Ques 29. What is RESTful Web API?
RESTful Web API (Representational State Transfer) is an architectural style that uses standard HTTP methods (GET, POST, PUT, DELETE) for communication and relies on stateless, client-server interactions.
Example:
GET /users/1
Ques 30. Explain the difference between PUT and POST methods in HTTP.
PUT is used to update or create a resource if it doesn't exist, while POST is used to submit data to be processed to a specified resource.
Example:
PUT /users/1 {"name": "John"}
Most helpful rated by users: