How to assign a mimetype to document being created using REST API? (Alfresco 5.2)

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

How to assign a mimetype to document being created using REST API? (Alfresco 5.2)

hi,

I am wondering if there is anyway we can set/assign the content-mime type of a document being created using REST API.

I use the below this rest api  and I need to be able to set mimetype directly when the document is being created. 

Is that possible?

I did a few try and errors it seems that mimetype is determined based on the extension given to the name property passed to the api.

So if I for example use the below as the json post parameter, the mimetype becomes application/pdf but 

{
"name": "filename.pdf",
"nodeType": "string",

}

if use the below, the mimetype becomes applicaiton/image. 

{
"name": "filename.png",
"nodeType": "string",

}

Please advise if that can be set using REST API.

Thank you,

1 Reply
Alfresco Employee

Re: How to assign a mimetype to document being created using REST API? (Alfresco 5.2)

You cannot set mime type when uploading, as it's autodetected. 

If you find any case where this detection process fails, you can modify mime type after uploading the content.

Software Engineer in Alfresco Search Team.