2 Replies Latest reply on Aug 23, 2016 9:26 AM by jfritz

    I need to upload several thousand MS Office documents. I have some files uploaded but I need to apply the original author and dates to the files. Can the files be uploaded with original meta data and/or can uploaded files be post processed with the proper

    jfritz

      I need to upload several thousand MS Office documents. I have some files uploaded but I need to apply the original author and dates to the files. Can the files be uploaded with original meta data in one operation, and/or can uploaded files be post processed with the proper meta data?

        • Re: I need to upload several thousand MS Office documents. I have some files uploaded but I need to apply the original author and dates to the files. Can the files be uploaded with original meta data and/or can uploaded files be post processed with the pr

          Hi Jim,

           

          This can be completed with our REST API's in one request per file, after the file has been uploaded (multi-part request). You can assign authors and tags to each of the files:

          Jive REST API v3.14 → File entity

           

          You can run a batch request to not bog down your instance and minimize errors:

          Jive REST API v3.14 → Batch service 

            • Re: I need to upload several thousand MS Office documents. I have some files uploaded but I need to apply the original author and dates to the files. Can the files be uploaded with original meta data and/or can uploaded files be post processed with the pr
              jfritz

              Thanks Rashed,

               

              The updated metadata does not take effect  when applied at upload see:

              url = self.jiveApiBaseUrl+"places/"+placeId+"/contents"

                          hd,lfn = os.path.split(path)

                          title,auth,cre,upd = Utils.my_olemeta(path)

                          cret = cre.strftime("%Y-%m-%dT%H:%M:%S")

                          updt = upd.strftime("%Y-%m-%dT%H:%M:%S")

                          dat = json.dumps({

                              "name" : contentLabel,

                              "type" : "file",

                              "parent" : self.jiveApiBaseUrl+"places/"+placeId,

                              "author" : {"formatted" : auth},

                              "published" : cret,

                              "updated" : updt,

                              "subject" : title,

                              "categories" : [contentLabel],

                              "content" : {

                                "type" : "text/html",

                                "text" : "<body><p>"+contentLabel+"</p></body>"

                              }})

              This JSON payload was applied via CURL and was a successful upload except the dates and author were ignored. Was this a legitimate attempt?

               

              To address the files uploaded with incorrect metadata, what is the most efficient method to identify the content to be updated, given either title or filename? The code below could  not find a non null contentID

               

                          url = '%ssearch/contents?filter=search(%s)'%(self.jiveApiBaseUrl,lfn) #URL of file to be updated

                          gret = self.__get(url)

                          for i in gret['list']:

                              if i["subject"] == title.decode("utf-8").lstrip() and i['status'] <> u'deleted' : #found file

                                  did = i['contentID'] # Extract contentID of file   ########## Never found

                                  break

                          url = '%scontents/%s'%(self.jiveApiBaseUrl,did)

                          doc = self.__get(url) # Read file dict'

                          doc['author']['name']['formatted'] = auth

                          doc['published'] = cret  # Sample data to update

                          doc['updated'] = updt    # Data looks good in dict before put

                          sdoc = json.dumps(doc)

                          putret = self.__putAs(url, sdoc)

               

              My testing was done trying to update a single file, then the file was deleted.  The content search shows multiple, matches to title but ALL show status=deleted and contentID=null

               

              How do I locate the file to update metadata?