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

  • Ryan Kramer
    Ryan Kramer ✭✭✭✭✭
    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

  • Ryan Kramer
    Ryan Kramer ✭✭✭✭✭
    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

  • @Ryan Kramer

    Thanks for the response.

    This does help, much appreciated.

  • Ryan Kramer
    Ryan Kramer ✭✭✭✭✭

    @Emskie321,

    Glad to hear it!

    Let me know if you get stuck.

    Ryan

  • @Ryan Kramer

    Hi Ryan,

    I am looking for some examples of a script, which uses the POST method to update specific columns in Smartsheet.

    Many Thanks.

  • Ryan Kramer
    Ryan Kramer ✭✭✭✭✭

    @Emskie321,

    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.

    旋度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" : "[email protected]","name": "John Doe"}, {"objectType": "CONTACT","email": "[email protected]","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

    我的帖子(s)帮助或一个吗swer your question or solve your problem? Please support the Community bymarking 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!

  • @Ryan Kramer

    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,

  • Ryan Kramer
    Ryan Kramer ✭✭✭✭✭

    @Emskie321,

    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

    我的帖子(s)帮助或一个吗swer your question or solve your problem? Please support the Community bymarking 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!

Hey @Archie Villa<\/a> <\/p>

This is saying that your referenced column ID (in this case, 42053562797956<\/strong>) cannot be found in that specific sheet since columns are unique to each sheet. <\/p>

Is it possible you're trying to reference a column that has since been deleted?<\/p>

One way to check this is to do a quick Get Column call: https:\/\/smartsheet.redoc.ly\/tag\/columns#operation\/column-get<\/a><\/p>

If this returns an error, use a Get Sheet call to return all the column IDs for that sheet and check to make sure you have all the numbers in the correct order for what you want to do: https:\/\/smartsheet.redoc.ly\/tag\/sheets#operation\/getSheet<\/a><\/p>

Cheers,<\/p>

Genevieve<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":320,"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[]},{"discussionID":110440,"type":"question","name":"Smartsheet API Call","excerpt":"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,","snippet":"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…","categoryID":320,"dateInserted":"2023-09-19T16:45:10+00:00","dateUpdated":null,"dateLastComment":"2023-10-10T14:03:37+00:00","insertUserID":166537,"insertUser":{"userID":166537,"name":"Emskie321","title":"Mr","url":"https:\/\/community.smartsheet.com\/profile\/Emskie321","photoUrl":"https:\/\/lh3.googleusercontent.com\/a\/ACg8ocLQ3XNhEe-vhgR7uLjCh-xFnB62fGRy-ciu3nJ2IkX6=s96-c","dateLastActive":"2023-10-25T10:30:04+00:00","banned":0,"punished":0,"private":false,"label":"✭✭"},"updateUserID":null,"lastUserID":120447,"lastUser":{"userID":120447,"name":"Ryan Kramer","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Ryan%20Kramer","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-10-20T14:55:24+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":7,"countViews":250,"score":null,"hot":3392092727,"url":"https:\/\/community.smartsheet.com\/discussion\/110440\/smartsheet-api-call","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/110440\/smartsheet-api-call","format":"Rich","tagIDs":[227,319],"lastPost":{"discussionID":110440,"commentID":399264,"name":"Re: Smartsheet API Call","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/399264#Comment_399264","dateInserted":"2023-10-10T14:03:37+00:00","insertUserID":120447,"insertUser":{"userID":120447,"name":"Ryan Kramer","title":"","url":"https:\/\/community.smartsheet.com\/profile\/Ryan%20Kramer","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-10-20T14:55:24+00:00","banned":0,"punished":0,"private":false,"label":"✭✭✭✭✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-09-21T16:36:09+00:00","dateAnswered":"2023-09-20T19:35:30+00:00","acceptedAnswers":[{"commentID":396313,"body":"

So the best way to do this is to have a script run locally or hosted somewhere outside of Smartsheet. <\/p>

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. <\/p>

We do these types of integrations all the time for various clients.<\/p>

Hope that helps!<\/p>

Ryan<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":320,"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":227,"urlcode":"api-and-developers","name":"API and Developers"},{"tagID":319,"urlcode":"functionality","name":"functionality"}]},{"discussionID":110797,"type":"question","name":"COUNTIFS and OR","excerpt":"Hello, I am having trouble getting my COUNTIFS formula containing an OR to work. I need it to count based on range 1 and a second column containing either Planned or Submitted. =COUNTIFS({RegSci Review Projections Range 1}, [Primary Column]@row, OR({RegSci Review Projections Range 2} = \"Planned\", {RegSci Review Projections…","snippet":"Hello, I am having trouble getting my COUNTIFS formula containing an OR to work. I need it to count based on range 1 and a second column containing either Planned or Submitted.…","categoryID":320,"dateInserted":"2023-09-26T16:51:09+00:00","dateUpdated":null,"dateLastComment":"2023-09-26T17:02:54+00:00","insertUserID":167224,"insertUser":{"userID":167224,"name":"RobynK","url":"https:\/\/community.smartsheet.com\/profile\/RobynK","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-10-24T15:01:26+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"updateUserID":null,"lastUserID":167224,"lastUser":{"userID":167224,"name":"RobynK","url":"https:\/\/community.smartsheet.com\/profile\/RobynK","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-10-24T15:01:26+00:00","banned":0,"punished":0,"private":false,"label":"✭"},"pinned":false,"pinLocation":null,"closed":false,"sink":false,"countComments":2,"countViews":121,"score":null,"hot":3391496043,"url":"https:\/\/community.smartsheet.com\/discussion\/110797\/countifs-and-or","canonicalUrl":"https:\/\/community.smartsheet.com\/discussion\/110797\/countifs-and-or","format":"Rich","tagIDs":[254],"lastPost":{"discussionID":110797,"commentID":397010,"name":"Re: COUNTIFS and OR","url":"https:\/\/community.smartsheet.com\/discussion\/comment\/397010#Comment_397010","dateInserted":"2023-09-26T17:02:54+00:00","insertUserID":167224,"insertUser":{"userID":167224,"name":"RobynK","url":"https:\/\/community.smartsheet.com\/profile\/RobynK","photoUrl":"https:\/\/us.v-cdn.net\/6031209\/uploads\/defaultavatar\/nWRMFRX6I99I6.jpg","dateLastActive":"2023-10-24T15:01:26+00:00","banned":0,"punished":0,"private":false,"label":"✭"}},"breadcrumbs":[{"name":"Home","url":"https:\/\/community.smartsheet.com\/"},{"name":"Get Help","url":"https:\/\/community.smartsheet.com\/categories\/get-help"},{"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers"}],"groupID":null,"statusID":3,"attributes":{"question":{"status":"accepted","dateAccepted":"2023-09-27T11:42:22+00:00","dateAnswered":"2023-09-26T16:59:25+00:00","acceptedAnswers":[{"commentID":397008,"body":"

Try this: =COUNTIFS({RegSci Review Projections Range 1}, [Primary Column]@row, {RegSci Review Projections Range 2}, OR(@cell = \"Planned\", @cell = \"Submitted\"<\/p>"}]}},"status":{"statusID":3,"name":"Accepted","state":"closed","recordType":"discussion","recordSubType":"question"},"bookmarked":false,"unread":false,"category":{"categoryID":320,"name":"API & Developers","url":"https:\/\/community.smartsheet.com\/categories\/api-developers","allowedDiscussionTypes":[]},"reactions":[{"tagID":3,"urlcode":"Promote","name":"Promote","class":"Positive","hasReacted":false,"reactionValue":5,"count":0},{"tagID":5,"urlcode":"Insightful","name":"Insightful","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":11,"urlcode":"Up","name":"Vote Up","class":"Positive","hasReacted":false,"reactionValue":1,"count":0},{"tagID":13,"urlcode":"Awesome","name":"Awesome","class":"Positive","hasReacted":false,"reactionValue":1,"count":0}],"tags":[{"tagID":254,"urlcode":"formulas","name":"Formulas"}]}],"initialPaging":{"nextURL":"https:\/\/community.smartsheet.com\/api\/v2\/discussions?page=2&categoryID=320&includeChildCategories=1&type%5B0%5D=Question&excludeHiddenCategories=1&sort=-hot&limit=3&expand%5B0%5D=all&expand%5B1%5D=-body&expand%5B2%5D=insertUser&expand%5B3%5D=lastUser&status=accepted","prevURL":null,"currentPage":1,"total":223,"limit":3},"title":"Trending in API & Developers","subtitle":null,"description":null,"noCheckboxes":true,"containerOptions":[],"discussionOptions":[]}">

趋势在API和开发人员