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

Flutter: How does column layout work?

Layouts are the fundamental starting points for developing Flutter applications. There are many layout options are available by default. I am going...

Flutter: Stateless vs Stateful widgets

Flutter is a mobile application development framework developed by Google. You need to understand the fundamental building blocks before you dig deeper...

Why Flutter is a great technology for makers &...

As per the wikipedia, Flutter is an open source UI development kit created by Google. It is used to...

Why 12-Factory methodology matters to your Microservice development?

The 12-Factor application development methodology and why is it important for your microservices strategy

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...

Similar articles