Home » REST

Tag Archives: REST

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 »

Richardson Maturity Model and Pizzas

java-interview-questions-answers

The model, developed by Leonard Richardson, attempts to classify an API according to its adherence to the constraints imposed by REST. The more compliant your implementation, the better it fares. There are four levels. The bottom is level 0, which designates the less compliant implementation, and the top is level 3, which is the most compliant and therefore the most ...

Read More »

RAML: Four ways to define examples

java-interview-questions-answers

Defining an example body payload and response for a RESTful API endpoint is an essential aspect of designing a modern API. These examples ensure that it is clear what the API contract expects to receive from the client and to respond with to the client. In this post, I will highlight four ways to specify the expected incoming and outgoing ...

Read More »

REST: Retrieving resources

java-interview-questions-answers

Retrieving resources is probably the simplest REST API operation. It is implemented by sending a GET request to an appropriate resource URI. Note that GET is a safe HTTP method, so a GET request is not allowed to change resource state. The response format is determined by Content-Negotiation. Retrieving collection resources Collections are retrieved by sending a GET request to ...

Read More »

Introduction to Hypermedia REST APIs

java-interview-questions-answers

Introduction When browsing the web we typically navigate from one site to another by following Hyperlinks. Those links make the web for humans discoverable. Hypermedia APIs provide the same discoverability for services. According to Roy Fielding Hypermedia is an essential part of a REST API and the Richardson REST Maturity Model describes Hypermedia as the final step to the glory ...

Read More »

RESTful API Design

java-interview-questions-answers

There are five principal aspects to a RESTful API specification that must be considered prior to coding an API specification. In this post I will discuss those five features with examples using a product use case. Before I get started let’s ensure that we understand what is meant by API and REST. If you are already familiar with API design ...

Read More »

REST: Managing One-To-Many relations

java-interview-questions-answers

In a previous post we looked at many-to-many relations. This time we will see how to model one-to-many relations in a RESTful API. An important question here is, if both sides of the relation can exist on their own (similar to typical many-to-many relations) or if the many-side is tightly coupled to the one-side. In the following we will examine ...

Read More »

RESTful services with HATEOAS: Hypermedia, Optional Or Not?

java-interview-questions-answers

1. Introduction In this last, conclusive part of the tutorial we are going to compile our thoughts, what we have learnt so far, and come up with the answer to a single question: could we ignore hypermedia and HATEOAS altogether, essentially relaxing (intentionally or not) one of the mandatory constraints of REST architectural style, and still pretend we are building ...

Read More »

REST: Creating resources

java-interview-questions-answers

Resource creation is a common REST API operation. In this post we will see how single resource can be created. The client request Resources are typically created by sending a POST request to the parent collection resource. This creates a new subordinate resources with a newly generated id. For example, a POST request to /projects might be used to create ...

Read More »