Using the API to get attachment URLs
I have PDF row attachments in a sheet. I need to get a direct URL to the attachment but I can't see a way to do this in the API.
Using the GUI to "send" the file provides a link - so I'm trying to get something similar through the API. I'm aware that the the URL using the GUI method expires after 30 days. I would prefer them to be permanent, but if that isn't possible, a 30 day link will suffice.
Best Answer
-
You make a call to
https://api.smartsheet.com/2.0/sheets/$Sheet_ID?include=attachments
substituting $Sheet_ID for the sheet ID and get the attachment id for each row
Then call
https://api.smartsheet.com/2.0/sheets/$Sheet_ID/attachments/$This_Attachment_ID
which will return the direct link for the attachment.
/marc
Answers
-
You make a call to
https://api.smartsheet.com/2.0/sheets/$Sheet_ID?include=attachments
substituting $Sheet_ID for the sheet ID and get the attachment id for each row
Then call
https://api.smartsheet.com/2.0/sheets/$Sheet_ID/attachments/$This_Attachment_ID
which will return the direct link for the attachment.
/marc
-
Thanks this kind of worked, however the url expires within a minute so it isn't useful.
I tried adding an expiration of 7776000000 ms (90 days) and it seemed like it lasted slightly longer, but was expired within a few minutes.
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
- 141 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives