NodeJS Express MySQL REST API CRUD Example

Here I am going to show you how to create REST API CRUD example using Nodejs Express and MySQL server. CRUD means Create, Read, Update and Delete operations which are performed through REST (Representational State Transfer) resources that works on http/https protocol. REST resources or APIs work on verbs, such as, GET, POST, PUT, DELETE, etc. So it is obvious that GET means you need to fetch data from the server endpoint, POST means you need to create the new resource on server endpoint, PUT means you need to update…

Continue

REST API – HTTP GET with Request Body

Here we are going to discuss about whether it is a good idea to send parameter in request body of the HTTP GET request or not. We will also discuss about idempotent and safe methods. When you are doing a GET request on entity, you are actually requesting the content of the entity. If you want to add some parameters (for example sorting a list in ascending or descending order), you can add these parameters in the query string. Alternatively you may also want to specify these parameters in the…

Continue

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…

Continue

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…

Continue

Convert List, Map to JSON in REST Response using Jersey

Introduction In this post we will see how to convert List, Map to JSON in REST Response using Jersey API. We will create three separate REST methods to convert List to JSOn, Map to JSON and List of Map to JSON string. We will annotate the REST resource class with @Path for having the base URI of the REST resources. We will use @Produces annotations to indicate what type of data the REST resource methods will produce in the response. We also use @GET annotation for http GET verb. The…

Continue