Upload new version with 'mimeType': 'application/binary'

cancel
Showing results for 
Search instead for 
Did you mean: 
idebonis
Active Member II

Upload new version with 'mimeType': 'application/binary'

Hello everybody.

I want to upload a signed pdf as a new version of an unsigned pdf. I encode the pdf in binary utf-8 and send it through the API to upload new version of a file.

Whenever I do so, I end up erasing the cryptography of the signature. Also I get these mimetypes:

 'application/pdf',
'mimeTypeName': 'Adobe PDF Document'

When I upload it as a new document, I maintain the cryptography of the signature and get the following mimetype:

'mimeType': 'application/binary'

I'm using this code in python:

url = alf_url + 'alfresco/api/-default-/public/alfresco/versions/1/nodes/' + \
    nodeId + '/content?majorVersion=true&name=filename.pdf"

headers = {"Authorization": "Basic " + ticket64,
           "Accept": "application/json",
           "Content-Type": "application/binary"}

files = {'file': fileData}
resp = requests.put(url, headers=headers, files=files, verify=False)

I also tried with the CMIS library, but it doesn't have a function to upload new versions of a file.

 

I hope you can help me.

Best regards,

Ignacio