title: Apache NiFi REST Api using java
body: <p>I'm still learning programming Apache NiFi using java and I wonder if anyone could explain to me how to instantiate a NiFi platform using NiFi REST APIs &amp; java? Any solution to create processor using Apache NiFi REST API and java.</p>
  
  <p><strong>UPDATES</strong>
  So I was trying this out : </p>
  
  <pre><code> import java.io.IOException;
  
  import org.apache.http.HttpResponse;
  import org.apache.http.client.HttpClient;
  import org.apache.http.client.methods.CloseableHttpResponse;
  import org.apache.http.client.methods.HttpPost;
  import org.apache.http.impl.client.CloseableHttpClient;
  import org.apache.http.impl.client.DefaultHttpClient;
  import org.apache.http.impl.client.HttpClients;
  
  
  
  
  public class HttpClientTest {
      public static void main(String[] args) throws IOException {
           CloseableHttpClient client = HttpClients.createDefault();
           HttpPost httpPost = new HttpPost("http://localhost:8080/nifi-api/process-groups/5f577c63-0170-1000-deb5-b53c37656ad4/template-instance");
           CloseableHttpResponse response = client.execute(httpPost);
              System.out.println(response.getStatusLine());
              client.close();
  
              }
          }
  </code></pre>
  
  <p>But always :
  <a href="https://i.stack.imgur.com/pwU8e.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pwU8e.png" alt="HTTP/1.1 400 Bad Request"></a></p>