smartsheet-apismartsheet-api-2.0

Is there any easy method to getting the Column Title when using GET Row with the Smartsheet API?


Is there any easy method to getting the Column Title when using GET Row with the API? New to API. I'm utilizing Microsoft Power Automate for these calls to push updates to Teams and such (more custom than what comes natively from Smartsheet).

I'm utilizing this address from the documentation: https://api.smartsheet.com/2.0/sheets/{SheetID}/rows/{rowID}, and then I add this string to the end of that URL to get discussions and columns: "?include=discussions,columns" which will include a separate array named "Columns".

What I'm wanting to do is get the "Column title" within the initial GET Row action. It would show up within the "cells" array when doing a GET Row API call.

Here's an example of what is obtained in the "cells" array when GET Row is used:

   "cells": [
     {
        "columnId": 4151830841190276,
        "value": "New task.",
        "displayValue": "New task."
      }
            ]

And here's an example of what's obtained in that Columns array, which comes separate:

"columns":  [
{
        "id": 4151830841190276,
        "version": 0,
        "index": 3,
        "title": "Item Name",
        "type": "TEXT_NUMBER",
        "primary": true,
        "validation": false,
        "width": 300
      }

Which is fine, I can do lookups to bridge the gap between the ColumnID I obtain from "get row" and the Columns array that's also returned...but ideally I'd like to just get the ColumnID Title in the native "GET Row" action, preventing this workaround. Any ideas, or am I doing it the best way?


Solution

  • You can't get column information (title, type, options...) while specifically reading rows.

    You have 2 options:

    Both solution should be working, I would suggest the second solution since only one API call is needed, but need more work processing the data.