Home » REST

Tag Archives: REST

File down – and uploads in RESTful web services

java-interview-questions-answers

Usually we use standard data exchange formats like JSON or XML with REST web services. However, many REST services have at least some operations that can be hard to fulfill with just JSON or XML. Examples are uploads of product images, data imports using uploaded CSV files or generation of downloadable PDF reports. In this post we focus on those ...

Read More »

Rest API Documentation and Client Generation with OpenAPI

java-interview-questions-answers

Microservices architecture helps in building an application as a suite of multiple fine-grained smaller services. Each of these services run in its own process and are independently deployable. They may have been developed in different programming languages and may use different data storage techniques and communicate with each other via lightweight mechanisms like RESTful APIs, message queues etc. Now that ...

Read More »

Supporting bulk operations in REST APIs

java-interview-questions-answers

Bulk (or batch) operations are used to perform an action on more than one resource in single request. This can help reduce networking overhead. For network performance it is usually better to make fewer requests instead of more requests with less data. However, before adding support for bulk operations you should think twice if this feature is really needed. Often ...

Read More »

REST API Design: Dealing with concurrent updates

java-interview-questions-answers

Concurrency control can be an important part of a REST API, especially if you expect concurrent update requests for the same resource. In this post we will look at different options to avoid lost updates over HTTP. Let’s start with an example request flow, to understand the problem: We start with Alice and Bob requesting the resource /articles/123 from the ...

Read More »

REST: Partial updates with PATCH

java-interview-questions-answers

In previous posts we learned how to update/replace resources using the HTTP PUT operation. We also learned about the differences between POST, PUT and PATCH. In this post we will now see how to perform partial updates with the HTTP PATCH method. Before we start, let’s quickly check why partial updates can be useful: Simplicity – If a client only ...

Read More »

Spring MVC REST

spring-interview-questions-answers

Representational state transfer (REST) is an architectural style that describes best practices to expose web services over HTTP, emphasizing performance, scalability, simplicity, modifiability, visibility, portability, and reliability. REST exposes resources through URIs using nouns (not verbs), supporting a limited set of operations (GET, PUT, POST, DELETE). Clients can request particular representations (HTML, XML, JSON, etc) that can link to other ...

Read More »

REST: Sorting collections

java-interview-questions-answers

When building a RESTful API we often want to give consumers the option to order collections in a specific way (e.g. ordering users by last name). If our API supports pagination this can be quite an important feature. When clients only query a specific part of a collection they are unable to order elements on the client. Sorting is typically ...

Read More »

REST: Updating resources

java-interview-questions-answers

When building RESTful APIs over HTTP the PUT method is typically used for updating, while POST is used for creating resources. However, create and update operations do not perfectly align with the HTTP verbs PUT and POST. In certain situations PUT can also be used for resource creation. See my post about the differences between POST, PUT and PATCH for ...

Read More »

REST: Deleting resources

java-interview-questions-answers

In RESTful APIs resources are typically deleted using the HTTP DELETE method. The resource that should be deleted is identified by the request URI. DELETE is an idempotent HTTP operation. Sending the same DELETE request multiple times should only alter the server state once. Deleting single resources Single REST resource are usually identified by URIs containing a unique identifier. For ...

Read More »