Helidon: Microservice REST API

Writing REST API with the Helidon framework is not a hard job since it is compliant with Microprofile specification. The good part is that we don’t need to learn any new technology or annotation to achieve this. In this example below I am going to explain how to write REST API by following Helidon MP.

The code is as follows,

public class Country {
    private String code;
    private String name;
    private String capital;

    public Country() {}

    public Country(String code, String name, String capital) {
        this.code = code;
        this.name = name;
        this.capital = capital;

    public String getCode() {
        return code;

    public String getName() {
        return name;

    public String getCapital() {
        return capital;
public class CountryManager {
    public List<Country> all() {
        return CollectionsHelper
                        new Country("IND", "India", "New Delhi"),
                        new Country("AUS", "Australia", "Canberra")
public interface ICountryApi {
    Response all();
public class CountryApi implements ICountryApi {
    CountryManager manager;

    public Response all() {
        System.out.println("Enters Country api");
        return Response
//Finally add an entry into the application
public class DailyApiApplication extends Application {

    public Set<Class<?>> getClasses() {
        return CollectionsHelper.setOf(
Finally access the API using,

The code is so simple and straight forward. The entire code follows the annotation of JAX-RS specification which is part of our Microprofile specification. So the learning curve is nothing and no code is specific with Helidon. This is the beauty of Microprofile and the compliant frameworks. We can simply move this code to different Microprofile vendors based on our organization strategy changes. No code change is required to move between vendors.

{ Happy coding }

API Evangelist | Chief Hustler @workrituals.com | Habit Coach | Madras Java User Group Leader

Latest articles

When to use Firebase Cloud functions?

Recently I got a question from one of the Indie makers that, when to use Firebase Cloud Functions? This...

Jakarta Tech Talk: Build Microservice using Microprofile + Helidon

Recently I gave a presentation on Jakarta Tech Talk series on 'Building a Microservice using Microprofile + Helidon. Enjoy watching the presentation...

Serverless REST APIs made simple with Cloud functions

Introduction Serverless is one of the top keyword in the integration space right now. Everyone is talking about the...

How to get started with Google cloud functions?

The 'Cloud Functions' is a Google technology bundled as part of the Firebase platform. It is a serverless backend to support our...

Why Firebase is a great technology for ‘Indie Makers’...

Firebase is a technology developed by Google. In this article, I am going to explore why Firebase is a great technology for...

Similar articles