SmartSheet API - Node.js SDK addRowUrlAttachment
What is the request body syntax when using the addRowUrlAttachment method in the Node SDK? The API documentation only shows an example using the addRowFileAttachment method.
Answers
-
I have only uploaded file attachments via the API, and not used Links. And I am not on a system where I can test this, but my reading of the documents say that you would need to specify the
attachmentType
and maybe thefileName
// Set options var options = { sheetId: 1696803624483716, rowId: 1049041355358596,
"url": "https://example.com/my/myDocument.pdf", "attachmentType": "LINK", fileName: "myDocument.pdf" }; // Attach file to row smartsheet.sheets.addRowFileAttachment(options) .then(function(attachment) { console.log(attachment); }) .catch(function(error) { console.log(error); });If you are linking to files hosted in one of the specified services, you would need to alter the attachmentType. Dropbox would be
"attachmentType": "DROPBOX"
-
That unfortunately doesn't work. I simply want to know what the arguments are for the addRowUrlAttachment method. "url" doesn't work because it alters the API URL route itself.
-
Hi @Josh Rosenfeld!
Currently, Smartsheet Support does not handle SDK-related inquiries. If you’ve tested and found an issue with the SDK, please report it on the relevant GitHub page. You can access the links to these pages in our API documentation here: Smartsheet API Documentation.
Should you not get a response from the Community, consider checking out StackOverflow to connect with other developers to get more help.
Cheers,Isaac.
Need more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions -
To add a URL attachment to a row in Smartsheet using the Node.js SDK, you can follow these steps:
Install Smartsheet SDK:
First, ensure you have the Smartsheet SDK for Node.js installed. You can do this via npm:npm install smartsheet
Set Up Smartsheet Client:
Initialize the Smartsheet client with your API token:const smartsheet = require('smartsheet');
const client = smartsheet.createClient({ accessToken: 'YOUR_ACCESS_TOKEN' });Add a URL Attachment to a Row:
You can add a URL attachment to a specific row using theaddRowUrlAttachment
function. Here’s an example:const sheetId = YOUR_SHEET_ID; // Replace with your sheet ID
const rowId = YOUR_ROW_ID; // Replace with your row IDconst attachment = {
name: 'Example URL', // The name of the attachment
description: 'Link to example', // Optional description
attachmentType: 'LINK', // The type of attachment
url: 'https://www.example.com' // The URL to attach
};client.attachments.addRowUrlAttachment({ sheetId, rowId, attachment })
.then(response => {
console.log('Attachment added:', response);
})
.catch(error => {
console.error('Error adding attachment:', error);
});- Explanation:
sheetId
androwId
: These are the IDs of the sheet and row to which you want to add the URL attachment.attachment
object: This contains the details of the attachment includingname
,description
,attachmentType
, andurl
.
By following these steps, you can easily add a URL attachment to a row in Smartsheet using the Node.js SDK. If you encounter any issues, make sure your API token and IDs are correct, and refer to the Smartsheet API documentation for more details.
For further reference, you can check the Smartsheet API Documentation and the Node.js SDK GitHub repository.
- Explanation:
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.1K Get Help
- 414 Global Discussions
- 221 Industry Talk
- 460 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