Microservices

This section includes tutorials, tips and tricks about microservices and Rest API’s.

Testing using Postman

Prerequisite

  1. Download PostMan.

  2. To be able to apply the steps in this tutorial, you will need to have a running microservice, we recommend building one using j-framework, check , Creating Simple Java Microservice using j-framework .

Instructions

1.Open Postman then click on new. image::postman/postman-home-screen.png[Postman Home]

2.Click on HTTP request. image::postman/http-request.png[HTTP Request]

3.GET request without parameter. image::postman/http-page.png[NO Params]

a.Select "GET"
b.Enter URL (e.g."http://localhost:8080/app/example/hello")
c.Click on send

GET without Params

You should see something like this .

4.GET with parameter

a.Select "GET"
b.Enter url (e.g."http://localhost:8080/app/example/hello/yourName")
c.Click on send

get-with-parameter
Figure 1. http GET request with parameter

See the output in figure 5.

Make sure you use get "http://localhost:8080/app/example/hello/{name}".

5.Using json "POST"

a.Select "POST"
b.Enter url (e.g."http://localhost:8080/app/example/hello")

change-to-post
Figure 2. Using json "POST"

c.Select Body ⇒ raw ⇒ JSON

post-json
Figure 3. select JSON
post-john.png
Figure 4. example json string

d.Enter JSON string (e.g. {"name":"John", "age":30} )

e.Click on send

post-json-done
Figure 5. output json "post"

See the output in figure 9.