Unable to Attach File to Row
curl https://api.smartsheet.com/2.0/sheets/{sheetId}/rows/{rowId}/attachments \ -H "Authorization: Bearer xxxx" \ -H "Content-Type: application/msword" \ -H 'Content-Disposition: attachment; filename="ProgressReport.docx"' \ -H "Content-Length: FILE_SIZE" \ -X POST \ --data-binary @ProgressReport.docx
Using Above API to attach a file but getting below errors -
1.If I don't Provide --data-binary @ProgressReport.docx then Getting error - "errorCode": 1011,"message": "A required header was missing or invalid: Content-Length"
2.After providing above tag get TimeOut error.
This is happening always. Do we need to provide "--data-binary @ProgressReport.docx" or providing Path in fileName will suffice ?
--data-binary Shoul contain all content of binary file eg --data-binary @"<<binary content>> ?"
Answers
-
Hi @Abhijit
First of all, please note that I removed out your Bearer token from this public Community post. Since it was visible for a period of time, I would recommend revoking your current token and generating a new one in order to keep your data secure.
In regards to Content-Length, this must be set to the size of the file, in bytes.
Ex:
Content-Length: 5463
You will then also need to provide the binary content for file. The new updated API documentation has details on what's required here: Post an Attachment.
Keep in mind the attachment size limits, which can be seen here.
Let me know if this has helped!
Cheers,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
@Genevieve P - Thanks for your reply.
The Bearer token was from smartsheet documentation and was not proper/correct token :)
After providing the binary content even for 1kb file I'm getting TimeOut error.
-
Hi @Abhijit
I'm not sure why you're receiving a timeout error. I would recommend reaching out to Smartsheet Support so you can provide them with your exact request, the file, and a screen capture of the error message. They can troubleshoot with you in a private channel.
Thanks,
Genevieve
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 142 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives