Web-service Interview Questions

  1.  Interceptor and its use 
  2.  How interceptor works 
  3.  Controller Advice 
  4.  How do we create interceptor 
  5. Rest
    1. Richardson Rest Maturity model (4 level that defines the maturity of rest servies)
    2. Rest Api
      1. in rest api a recommended term used to refer to multiple resources
      2. time to first hello world rest
      3. rest api to add the version in header by using accept and content type
        1. https://blog.allegro.tech/2015/01/Content-headers-or-how-to-version-api.html
    3.  Http Response Code 
    4. How communication is done between 2 rest services
    5. What is Response Body
    6. idempotent http req 
    7. restful services architecture 
    8. http methods
    9. API security
      1. using oauth , what scope is required for write access to api
      2. which grant type support refresh token
      3. property to include in json to represent subresources /in rest api (llinks/embedded?)
  6. benefit of GRAPHQL over rest approaches
  7. WebHooks vs sync api and usage
  8. how to handle transactional commit over distributed system (2phase commit , saga pattern – push or pull )
    • when to use push vs when to use pull mechanism

HTTP Verb CRUD Entire Collection (e.g. /customers) Specific Item (e.g. /customers/{id}) 
POST Create 201 (Created), ‘Location’ header with link to /customers/{id} containing new ID. 404 (Not Found), 409 (Conflict) if resource already exists.. 
GET Read 200 (OK), list of customers. Use pagination, sorting and filtering to navigate big lists. 200 (OK), single customer. 404 (Not Found), if ID not found or invalid. 
PUT Update/Replace 405 (Method Not Allowed), unless you want to update/replace every resource in the entire collection. 200 (OK) or 204 (No Content). 404 (Not Found), if ID not found or invalid. 
PATCH Update/Modify 405 (Method Not Allowed), unless you want to modify the collection itself. 200 (OK) or 204 (No Content). 404 (Not Found), if ID not found or invalid. 
DELETE Delete 405 (Method Not Allowed), unless you want to delete the whole collection—not often desirable. 200 (OK). 404 (Not Found), if ID not found or invalid. 

Restful Services

Following topics are covered

  1. PUT vs POST
  2. [System Design]Caching at which layer .. which data to be cached [same data shouldn’t be cached at different layer]
  3. Api Design
    1. data can be send at 3 different part path param/Query Param/Header..what’s the difference?

Resources []Books for referebce:

  1. RESTful Web Services by Leonard Richardson [Best as mentioned]
    1. You will learn what URI is, how HTTP can be used as an application-level protocol, and not just a transport protocol to transfer data between client and server.
    2. Complementry Tutorial https://www.udemy.com/course/restful-web-service-with-spring-boot-jpa-and-mysql/?ranMID=39197&ranEAID=JVFxdTr9V80&ranSiteID=JVFxdTr9V80-JwlMFe5sTRDlo0zYN7GLpg&LSNPUBID=JVFxdTr9V80&utm_source=aff-campaign&utm_medium=udemyads

Other Books

  1. https://www.java67.com/2017/06/top-10-rest-api-and-restful-web-services-book.html
  2. https://medium.com/javarevisited/top-5-books-and-courses-to-learn-restful-web-services-in-java-using-spring-mvc-and-spring-boot-79ec4b351d12 [S[rong Specific]
  3. https://medium.com/javarevisited/top-5-books-to-learn-web-services-in-java-soap-rest-22d92adbefc1

REST Architectural Constraints

  1. https://restfulapi.net/rest-architectural-constraints/
  2. https://www.geeksforgeeks.org/rest-api-architectural-constraints/
  3. https://restfulapi.net/hateoas/