0 Replies Latest reply on Sep 29, 2016 7:44 AM by itayy

    upload video with java unirest and jive api- example

    itayy

      hi,

      i will just put this here.

      code to upload video with jive rest api and unirest using java

      import java.io.File;
      import com.mashape.unirest.http.HttpResponse;
      import com.mashape.unirest.http.JsonNode;
      import com.mashape.unirest.http.Unirest;
      import com.mashape.unirest.http.exceptions.UnirestException;
      
      public static void main(String[] args)  {
      
           HttpResponse<String> jsonResponse;
                try {
                     jsonResponse = Unirest.post("https://your-Url/api/core/v3/{method}")
                     .routeParam("method", "contents")
                     .basicAuth("user", "pass")
                     .field("content",
                     "{'type': 'video',"
                          +"'parent' : 'https://your-Url/api/core/v3/places/PlaceID', "
                          +"'subject': 'name of the new video',"
                          +"'content':{ 'type': 'text/html', 'text': '<body><p>main text of video</p></body>'}}",
                     "application/json")
                     .field("file", new File("c:/my-Vid.mp4"))
                     .asString();
      
                } catch (UnirestException e) {
      
                e.printStackTrace();
                }
      }
      

       

       

      PlaceID = replace with the id of the place you want to put the video in

      your-Url = the URL of your community