AnsweredAssumed Answered

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

Question asked by kevin@puppetlabs.com on Mar 13, 2014
Latest reply on Aug 27, 2019 by rachakonda03

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"
     })

Outcomes