how to attach more than one file to a given smartsheet row by using without 4004 error
I have attached two attachments to a single row and got the following error. only one file was successfully connected to a given row of the smart sheet. I have called Attach file to row API endpoint with a loop. if I stay return the success message of each file attachment it will take much time and my API endpoint is useless. please guide me what is the best possible way to achieve this task.
POST /sheets/{sheetId}/rows/{rowId}/attachments
[error message ]=>
[Smartsheet] 2022-05-18T15:49:11.071Z[ WARN] Request failed, performing retry #1Cause: statusCode=500, date=Wed, 18 May 2022 15:49:10 GMT, content-type=application/json;charset=UTF-8, content-length=211, connection=close, server=Apache, vary=Accept-Encoding, content-encoding=gzip, x-envoy-upstream-service-time=123, x-smar-halo-version=1.1-821679-prod,
body={ "errorCode" : 4004,"message" : "Request failed because sheetId [smartsheetid] is currently being updated by another request that uses the same access token. Please retry your request once the previous request has completed.",
"refId" : "1vmo74qbn41ro"
}
code snippet :
files.map(element => { var uploadingFileOptions = {
sheetId: [smartsheet id]
rowId: [row id],
fileSize: fs.statSync(element).size,
fileName:'testfilename.pdf',
fileStream: fs.createReadStream(element)
};
res.send(uploadingFileOptions)
smartsheet.sheets.addRowFileAttachment(uploadingFileOptions)
.then(function (attachment) {
console.log(attachment)
})
.catch(function (error) {
console.log(error)
});
});
Answers
-
Hi @chaminda_97
Currently attachments added through the API do need to be completed one at a time. Here's the information on Posting an Attachment in the API Documentation, where it clarifies that both a a simple upload or a multipart upload will allow you to add just a single file attachment.
Cheers,
Genevieve
Join us at Smartsheet ENGAGE 2024 🎉
October 8 - 10, Seattle, WA | Register now -
thank you Genevieve P.,
please let me know if we upgrade the subscription to be HIPPA compliant, will that affect the API performance in any way?
-
Hi @chaminda_97
No, updating your plan to be HIPPA compliant should not have any affect on what you can do with the API. You will be using your own access token with the API to access the data in your account, so make sure you do not share that token with anyone else.
Cheers,
Genevieve
Join us at Smartsheet ENGAGE 2024 🎉
October 8 - 10, Seattle, WA | Register now
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 62.9K Get Help
- 379 Global Discussions
- 210 Industry Talk
- 441 Announcements
- 4.5K Ideas & Feature Requests
- 139 Brandfolder
- 129 Just for fun
- 130 Community Job Board
- 449 Show & Tell
- 30 Member Spotlight
- 1 SmartStories
- 300 Events
- 33 Webinars
- 7.3K Forum Archives