Smartsheet API Call
Hello Team,
Please let me know the best way to make an API call from Smartsheet to request data from another tool and how to handle the response. I know I need to use a GET request to make the API, call but I am not sure how to handle the response in Smartsheet.
Many Thanks,
Best Answer
-
So the best way to do this is to have a script run locally or hosted somewhere outside of Smartsheet.
You can then have this script make the "GET" requests to the various sources and pull that information locally and then push that data via a "POST" request to another source or potentially Smartsheet.
We do these types of integrations all the time for various clients.
Hope that helps!
Ryan
Answers
-
So the best way to do this is to have a script run locally or hosted somewhere outside of Smartsheet.
You can then have this script make the "GET" requests to the various sources and pull that information locally and then push that data via a "POST" request to another source or potentially Smartsheet.
We do these types of integrations all the time for various clients.
Hope that helps!
Ryan
-
-
-
Hi Ryan,
I am looking for some examples of a script, which uses the POST method to update specific columns in Smartsheet.
Many Thanks.
-
So an update is usually a PUT request and not a POST request.
And I see their API follows that pattern in the cURL implementation.
curl https://api.smartsheet.com/2.0/sheets/{sheetId}/rows \
-H "Authorization: Bearer JKlMNOpQ12RStUVwxYZAbcde3F5g6hijklM789" \
-H "Content-Type: application/json" \
-X PUT \
-d '[{"id": "6572427401553796", "cells": [{"columnId": 7518312134403972,"image": {"altText": "New Alt Text"},"value": "new value"}, {"columnId": 1888812600190852,"value": "A"}]}, {"id": "2068827774183300", "cells": [{"columnId": 7518312134403972,"value": "desc_updated"}, {"columnId": 1888812600190852,"value": "B"}, {"columnId": 6552023773538180,"objectValue": {"objectType": "MULTI_CONTACT","values": [{"objectType": "CONTACT","email" : "john.doe@smartsheet.com","name": "John Doe"}, {"objectType": "CONTACT","email": "jane.roe@smartsheet.com","name": "Jane Roe"}]}}]}]'
I generally prefer to use the respective SDK of my environment though. For me its almost always python -
# Build new cell value
new_cell = smartsheet.models.Cell()
new_cell.column_id = 7036894123976580
new_cell.value = "new value"
new_cell.strict = False
# Build the row to update
new_row = smartsheet.models.Row()
new_row.id = 6809535313667972
new_row.cells.append(new_cell)
# Update rows
updated_row = smartsheet_client.Sheets.update_rows(
2068827774183300, # sheet_id
[new_row])
Ryan
✅Did my post(s) help or answer your question or solve your problem? Please support the Community by marking it Insightful/Vote Up, Awesome, or/and as the accepted answer. It will make it easier for others to find a solution or help to answer!
-
Hi Ryan,
Thank you so much for confirming the Method to use and the examples provided.
They have helped me to get started with the API, I have been testing in Postman and it's going great!!
Just one last question, are you aware of any limitations in the number of cells that can be updated with the API at one time. I will be updating about 350 cells on a weekly basis.
Many thanks,
-
So I haven't had any cell limit per se since I normally look at these updates by rows and generally 500 rows at a time doesn't have issues for me.
I've built a lot of processes that read from external sources or other sheets and aggregates to make updates and generally as long as I stay under this limit, it doesn't have any issues. When I go over it, sometimes the calls will fail.
Ryan
✅Did my post(s) help or answer your question or solve your problem? Please support the Community by marking it Insightful/Vote Up, Awesome, or/and as the accepted answer. It will make it easier for others to find a solution or help to answer!
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 439 Global Discussions
- 138 Industry Talk
- 471 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives