File Attachment to Row
Hi Team ,
I am trying to attach file to smartsheet row with the following details,
https://api.smartsheet.com/2.0/sheets/{Sheet ID }/rows/{ Row ID }/attachments
Header :
Authorization:Bearer {ACCESS TOKEN}
Content-Type:image/jpeg
Content-Disposition:attachment; filename="C:\1.jpeg"
ContentLength:64
Response I am getting below is :
{
"message": "SUCCESS",
"resultCode": 0,
"result": {
"id": 6967695279187844,
"name": "C__1.jpeg",
"attachmentType": "FILE",
"mimeType": "image/jpeg",
"sizeInKb": 1,
"parentType": "ROW",
"parentId": 1936240127567748,
"createdAt": "2020-11-25T07:57:55Z",
"createdBy": {
"name": "Evaluation",
"email": "evaluation@vrio-fintech.com"
}
},
"version": 18
}
But the file which is attached is corrupted and throws following error ,
Same error happens with docx files as well, please help us in this regard.
Answers
-
Hi,
Can you check that you are setting the content length header correctly (it looks to have a missing hyphen it), and that you are setting the length correctly. I'd be surprised if it's only 64 bytes in size (although not impossible)
Also ensure you are setting the mime type correctly for the word doc as it's different than for a JPEG.
I can't say for definite that is the source of your problem but would be good to rule them out first.
-
Hi ,
Sorry , i was giving the content length in kb , i changed and gave it in bytes even then the same error occurs.
Also for the word document i have given the content type as application/msword. Sadly that didnt work as well.
Please find below the header details provided for attaching word document.
Authorization:Bearer {ACCESS TOKEN}
Content-Type:application/msword
Content-Disposition:attachment; filename="C:\1.docx"
ContentLength:68000
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 139 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 494 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives