Swagger REST API

Using JAX-RS API under JSR-339, it is easy to create REST services using excellent Java platform. But developers do not have any option using JSR-339 to generate any documentation on all these APIs so other developers could quickly understand how to use them. For sure, it would be just awesome to generate verbose and easy to follow documentation from source code, and but the help is coming in a form of Swagger.

Essentially, Swagger does a simple but very powerful thing: with a bit of additional annotations it generates the REST API descriptions such as HTTP methods, path / query / form parameters, responses, HTTP error codes etc) and even provides a simple web UI to play with REST calls to your APIs.

You may also like to explore Spring Boot REST API Documentation with Swagger 2 and  Documenting Spring REST API with Swagger 2

Continue reading “Swagger REST API”

Send data to remote REST web application using Mule ESB

In this tutorial I am going to show you how to send data from Mule application to remote web application which is basically a REST webservice application.

Prerequisites

Eclipse, JDK 1.8, JAX-RS jars 2.23.2
Have maven installed and configured
JAX-RS dependencies in pom.xml

For this tutorial we will create a web maven project in Eclipse. If you already have an idea on how to create a maven project in Eclipse will be great otherwise I will tell you here how to create a maven project in Eclipse. Continue reading “Send data to remote REST web application using Mule ESB”

Upload file using REST webservice

In this tutorial I am going to show you how we can upload file using REST or RESTful web service.

The most important concept in REST is resources, which are identified by global IDs — typically using URIs. Client applications use HTTP methods (GET/ POST/ PUT/ DELETE) to manipulate the resource or collection of resources. A RESTful Web service is implemented using HTTP and the principles of REST. Typically, a RESTful Web service should define the following aspects:

The base/root URI for the Web service such as http://<host>/<appcontext/contextpath>/<url pattern>/<resources>.
The MIME type of the response data supported, which are JSON/XML/TEXT/HTML etc.
The set of operations supported by the service. (for example, POST, GET, PUT or DELETE).

Continue reading “Upload file using REST webservice”

Download file using REST webservice

In this tutorial I am going to show you how we can download file using REST or RESTful web service.

The most important concept in REST is resources, which are identified by global IDs — typically using URIs. Client applications use HTTP methods (GET/ POST/ PUT/ DELETE) to manipulate the resource or collection of resources. A RESTful Web service is implemented using HTTP and the principles of REST. Typically, a RESTful Web service should define the following aspects:

The base/root URI for the Web service such as http://<host>/<appcontext/contextpath>/<url pattern>/<resources>.
The MIME type of the response data supported, which are JSON/XML/TEXT/HTML etc.
The set of operations supported by the service. (for example, POST, GET, PUT or DELETE).

Continue reading “Download file using REST webservice”