17 Replies Latest reply on Sep 14, 2017 12:01 PM by harshtsr

    How to use the API to upload a file from the local filesystem?

    kevin@puppetlabs.com

      I would like to be able to automate the upload of PDFs to jive using the API. I have found a way to create new documents, and add attachments from a public url. Using something like the following json format as the data for an API request works for those two things. Is there a parallel method for uploading something from a local filesystem?

          data = json.dumps(

      data= json.dumps(  
         { "content": {
                 "type": "text/html",
                 "text": "<body><p>Upload a file using the API</p></body>"
                 },
             "subject": "Upload a file using the API",
             "visibility": "place",
             "parent": "%s/api/core/v3/places/2801" % base_url,
             "attachments" : [{
                 "name" : "Test.pdf",
                 "type" : "attachment",
                 "contentType" : "application/pdf",
                 "url" : "https://www.foo.bar/test.pdf",
                 "doUpload" : "true"}],
             "type": "document"
           })