LET'S DEVELOP TOGETHER YOUR PRODUCT, TEST IT AND OPTIMIZE IT FOR SUCCESS

How to parse a Json in Java using Jackson framework – Chapter 1

How to parse a json that is the response from a call to an Endpoint in Java Let’s assume we have the following response: { “took”: 4, “timed_out”: false, “_shards”: { “total”: 5, “successful”: 5, “failed”: 0 }, “hits”: { “total”: 2, “max_score”: 1, “hits”: [             {                 “_index”: “event1_201708”,                 “_type”: “banner_event”,                 …

Create PUT request with body in Java – Chapter 3

How to use the Mediator class, an example: public void useMediator(int banner_id, String banner_user){ BodySource bodySource = new BodyRequestMediator(banner_id, banner_user).setBody(); //at this point we have constructed a whole object that is able to represent our desired json schema presented before as a body and indirectly called the constructor with 2 arguments in class Term: public …

Create PUT request with body in Java – Chapter 2

First Level Class – let’s call it BodySource – this will be the class that will be send with @Body annotation along with the PUT request This class should be further be constructed using its inner nodes represented as classed. Also a Builder design pattern is recommended to be used @JsonInclude(JsonInclude.Include.NON_NULL) @JsonPropertyOrder({ "query" }) public …

Create PUT request with body in Java – Chapter 1

How to build a PUT request with Body in Java using Retrofit @POST("/banner_event_{timeStamp}/_search") ExamplejsonParser createBodySource(@Path("timeStamp") String timeStamp, @Body BodySource bodySource); Let’s assume we have the following body that has to be sent with a PUT method to make an API call: { "query": { "filtered": { "filter": { "bool": { "must": [             {               …