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
- Customer Resources
- 64.9K Get Help
- 439 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 67 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives