I am working on some module where I am stuck with this question. I am using request module in node js. I have many example but they just sends only the file(not in json). I have working code in Java. Just trying how to do the same in node js
String json = "{ \"values\" : { ";
json += "\"Field1\" : \"xyz\", ";
json += "\"Field2\" : \"abc\", ";
json += "\"File Name\" : \"sample.jpg\"";
json += " } }";
// build the multipart entity
HttpEntity entity = MultipartEntityBuilder.create()
.addTextBody("entry", json, ContentType.APPLICATION_JSON)
.addBinaryBody("File 2", new File(filename))
.build();
httpPost.setEntity(entity);