I am struggling to automatically deploy new Flink jobs within our CI/CD workflows by using the Flink rest-api (which may be found here in the flink Github repository).
For those who want a java solution can use:
CloseableHttpClient client = HttpClients.createDefault();
HttpPost httpPost = new HttpPost("YOUR API URL");
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
builder.addBinaryBody("jarfile", new File("jarr.jar"));
HttpEntity multipart = builder.build();
httpPost.setEntity(multipart);
try{
CloseableHttpResponse response = client.execute(httpPost);
System.out.println(response);
BufferedReader rd = new BufferedReader(new InputStreamReader(
response.getEntity().getContent()));
String line = "";
while ((line = rd.readLine()) != null) {
System.out.println(line);
}
}
catch (Exception e){
e.printStackTrace();
}