title: Forward JSON POST request from one REST API to another
body: <p>I have the following situation:</p>
  
  <p>My REST API one:</p>
  
  <pre><code>@RestController
  @RequestMapping("/controller1")
  Public Class Controller1{
      @RequestMapping(method = RequestMethod.POST)
      public void process(@RequestBody String jsonString) throws InterruptedException, ExecutionException 
      {
         ............
      }
  }
  </code></pre>
  
  <p>JSON POST request, request1, for the REST API(Controller1):</p>
  
  <pre><code>{
    "key1":"value1",
    "key2":"value2"
  }
  </code></pre>
  
  <p>My REST API two:</p>
  
  <pre><code>@RestController
  @RequestMapping("/controller2")
  Public Class Controller2{
      @RequestMapping(method = RequestMethod.POST)
      public void process(@RequestBody String jsonString) throws InterruptedException, ExecutionException 
      {
         ............
      }
  }
  </code></pre>
  
  <p>JSON request, request2, for the REST API(Controller2):</p>
  
  <pre><code>{
    "key1":"value1",
    "key2":"value2",
    "key3":"value3"
  }
  </code></pre>
  
  <p>I have several such "primitive" requests. 
  Now, I am expecting a JSON request, let's call it request3, which is a combination of such "primitive" queries- something that looks like below:</p>
  
  <pre><code>{
     {
        "requestType":"requestType1",
        "request":"[{"key1":"value1","key2":"value2"}]"
     },
     {
        "requestType":"requestType2",
        "request":"[{"key1":"value1","key2":"value2","key3":"value3"}]"
     }
  }
  </code></pre>
  
  <p>Here, I need to trigger the respective API (one or two) upon identifying the query type. I wanna know how I can forward the request to the corresponding REST API. I wrote the REST API for request3 like below:</p>
  
  <pre><code>@RestController
  @RequestMapping("/controller3")
  Public Class Controller3{
      @RequestMapping(method = RequestMethod.POST)
      public void process(@RequestBody String jsonString) throws InterruptedException, ExecutionException 
      {
        ..................
        ..................
  
        switch(request){
           case request1: //how to call REST API 1?
           case request2: //how to call REST API 2?
        }
      }
  }
  </code></pre>