AnsweredAssumed Answered

File content type not set when uploading via rest PUT

Question asked by Brecht Yperman on Jun 26, 2017
Latest reply on Jun 28, 2017 by Matt Marum

I'm trying to upload a document to Sugar using the REST api. This works beautifully, but unfortunately the content type is not set.

 

I'm doing a PUT to:

Request URI: /sugarent/rest/v10/Documents/35522157-7e90-8df3-70fc-5950dbca37b9/file/filename/?filename=TDN.docx

 

One of the headers is the Content-Type:

Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

 

PUT /sugarent/rest/v10/Documents/35522157-7e90-8df3-70fc-5950dbca37b9/file/filename/?filename=TDN.docx HTTP/1.1

oauth-token: bb3bbc9b-64c3-6507-d82b-5950db1c2a4c

filename: TDN.docx

Content-Type: application/vnd.openxmlformats-officedocument.wordprocessingml.document

User-Agent: Jersey/2.22.1 (HttpUrlConnection 1.8.0_121)

Cache-Control: no-cache

Pragma: no-cache

Host: xpcrmsugar

Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2

Connection: keep-alive

Content-Length: 36629

 

The response however says the content-type is application/octet-stream.

 

{
"filename": {
"content-type": "application/octet-stream",
"content-length": 36629,
"name": "TDN.docx",
"uri": "rest/v10/Documents/35522157-7e90-8df3-70fc-5950dbca37b9/file/filename",
"doc_type": "Sugar"
},
"record": {

///
}
}

 

On some servers it says application/zip, but that is still not what I'm sending.

 

How can I specify the content-type?

 

Best regards,

Brecht

Attachments

Outcomes