Home » Tag Archives: REST (page 2)

Tag Archives: REST

What’s the case for your API?

java-interview-questions-answers

Disclaimer: In pure REST, API’s are opaque and the URL should be whatever what was sent as a link in the response to a previous request. But, I’m not talking pure REST, I’m talking more pragmatic APIs which involve some concepts from REST and as well as general API best practices. When writing an API, it starts simple. You identify the ...

Read More »

How to bind @RequestParam to object in Spring

spring-interview-questions-answers

Do you have multiple parameters annotated with @RequestParam in a request mapping method and feel it isn’t readable? The annotation looks pretty straightforward when there’s one or two input parameters expected in a request but when the list gets longer you might feel overwhelmed. You cannot use the @RequestParam annotation inside objects but it doesn’t mean you’re left with no ...

Read More »

Microservices Messaging: Why REST Isn’t Always the Best Choice

Microservices are a big business. Thanks to advances in container orchestration, multi-process applications development and sheer user demand, companies are edging away from traditional monolithic applications towards distributed, highly-available microservices. Breaking applications into smaller chunks reaps rewards in many guises. However, with this distribution there arises a new requirement: messaging for inter-service communication. How does microservices messaging tie back to ...

Read More »

A configurable JAX-RS ExceptionMapper with MicroProfile Config

java-interview-questions-answers

When you create REST services with JAX-RS, you typically either return nothing (so HTTP 201/2/4 etc) or some data, potentially in JSON format (so HTTP 200), or some Exception / Error (so HTTP 4xx or 5xx). We usually translate a Runtime Exception into some HTTP 5xx and a Checked Exception into some 4xx. Because we want to keep our boundary ...

Read More »

How to Invoke an External REST API from a Cloud Function

java-interview-questions-answers

In a previous blog post I showed how to create your first cloud function (plus a video). It’s very likely that your cloud function will need to invoke an external REST API. The following tutorial will show you how to create such function (it’s very easy). Sign into an IBM Cloud account Click Catalog Remove the label:lite filter and type ...

Read More »

Speed Up Services With Reactive API in Java EE 8

java-interview-questions-answers

Services can often be optimized with asynchronous processing even without changing their behavior towards the outside world. The reason why some services aren’t efficient is that they need to wait for other services to provide a result to continue further. Let’s look how to call external REST services without waiting for them and also do multiple parallel calls independently and ...

Read More »

And some more REST tips

java-interview-questions-answers

In previous blog posts I have covered some ideas and tips for achieving a REST architecture. In this post, I cover a few more ideas and tips. Caching Caching is a big part of the original dissertation.  See section 5.1.4  Strategies include validation (client checks it has the latest version) and expiration (client assumes it has the latest version until a ...

Read More »

REST: Using a Controller endpoint?

java-interview-questions-answers

In general REST architectures, the fundamental concept is a Resource.  After Resources, the next thing is to develop a Uniform Interface to these resources, which in HTTP land usually means: Create is POST Read is GET Update is PUT (or PATCH for Partial Update) Delete is DELETE In the real world, inevitably some operations won’t map so nicely to resources. ...

Read More »