0 Replies Latest reply on Sep 17, 2015 10:08 PM by ramchand_gururajan

    Reg: Uploading images to Jive via REST

    ramchand_gururajan

      Hi Team,

      Kindly please let me know if there are any working examples of uploading images via REST API

       

       

      we are getting 415. Can you please tell me are missing some thing here ?

       

      This is tried in java

       

             PostMethod methodImgUpl = new PostMethod(destinationBaseURL+Constants.imgServiceUrl);
         methodImgUpl.addRequestHeader("Content-Type","multipart/form-data");
             File fileToUpload = new File("img0.jpg");
             Part[] parts = {
                new StringPart("type", "image/jpg"),
                new StringPart("filename", "img0.jpg"),
                new StringPart("imageFile", "img0.jpg"),
                new FilePart(fileToUpload.getName(), fileToUpload)
            };
             methodImgUpl.setRequestEntity(
                new MultipartRequestEntity(parts, methodImgUpl.getParams())
                );            
             //createrObj.put("attachments",attchArry );
             int statusCodeImgUpl =   client.executeMethod(methodImgUpl);
           System.out.println("statu code "+statusCodeImgUpl);