title: curl Command using spring rest template
body: <p>I am posting JSON originally via terminal, which looks like this</p>
  
  <pre><code>curl http://api_server_address:port/api/v1/addmos_getAllVMMetadata -X POST -H 'Content-Type:application/json' --data 'v1'
  </code></pre>
  
  <p>And below what the code looks like using spring</p>
  
  <pre><code> public static void main(String args[]) {
      HttpHeaders headers = new HttpHeaders();
      headers.setContentType(MediaType.APPLICATION_JSON);
      String input = "v1";
      HttpEntity&lt;String&gt; request = new HttpEntity&lt;String&gt;(input, headers);
  
      RestTemplate restTemplate = new RestTemplate();
  Container container = restTemplate.postForObject("http://192.168.100.14:15001/api/v1/addmos_getAllVMMetadata", request, Container.class);
      List&lt;Tenant&gt; tenants = container.getData().getTenants();
      System.out.println("Tenant Size: " + tenants.size());
  </code></pre>
  
  <p>But when I run, hit the error NullPointer at the line getdata from gettenants. I already made a class for getData and getTenants as well.</p>
  
  <pre><code>public class Data {
  private List&lt;Tenant&gt; tenants = new ArrayList&lt;Tenant&gt;();
  
  public List&lt;Tenant&gt; getTenants() {
      return tenants;
  }
  
  public void setTenants(List&lt;Tenant&gt; tenants) {
      this.tenants = tenants;
  }
  </code></pre>
  
  <p>}</p>
  
  <pre><code>public class Data {
  private List&lt;Tenant&gt; tenants = new ArrayList&lt;Tenant&gt;();
  
  public List&lt;Tenant&gt; getTenants() {
      return tenants;
  }
  
  public void setTenants(List&lt;Tenant&gt; tenants) {
      this.tenants = tenants;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This is what my data structure would be look like.</p>
  
  <p><a href="https://i.stack.imgur.com/yk8Sb.jpg" rel="nofollow noreferrer">link to the data structure</a></p>
  
  <p>But I got below error when trying to run the code. Is there something I've missed? </p>
  
  <blockquote>
    <p>SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J:
    See <a href="http://www.slf4j.org/codes.html#StaticLoggerBinder" rel="nofollow noreferrer">http://www.slf4j.org/codes.html#StaticLoggerBinder</a> for further
    details. Exception in thread "main" java.lang.NullPointerException    at
    com.itri.openstacktopology.OpenstacktopologyclientApplication.main(OpenstacktopologyclientApplication.java:28)</p>
  </blockquote>