Multiple query parameters using the API's Search Sheet Method

SVCBluePrismUSR
edited 03/20/23 in API & Developers

Hello, I need to find out the ID of a line where the column "Column1" has X value and Column "Column2" has Y value, that is, my query has two parameters. (column:Column1 "X" column:Column2 "Y")

GET https://api.smartsheet.com/2.0/search/sheets/{sheetId}?query=column%3AColumn1%20%22X%22%20column%3AColumn2%20%22Y%22


I found some old posts that taught how to make a call using the Post method with a query of this style in the Body, however in the current API documentation it seems that this method does not exist.

Is there a possibility to use this method GET "Search Sheet"? What would be the query I need to use?

Answers

  • Jeff Reisman
    Jeff Reisman ✭✭✭✭✭✭

    If you can use the Smartsheet Live Data Connector to run a SQL query against the sheet, this is easy.

    A workaround for the API would be to create a filter on the sheet that only leaves rows with Column1 = X and Column2 = Y. Apply the filter on the sheet, then run a GET on the sheet, with a query parameter of include=filters. In the sheet information, under userSettings, you'll see "appliedSheetFilterId": - save that filterId.

    Then run your GET again, with query parameters:

    filterId={the filterId you saved}

    exclude=filteredOutRows


    You'll then only get the rows returned that fall under your filter.

    Regards,

    Jeff Reisman

    Link: Smartsheet Functions Help Pages Link: Smartsheet Formula Error Messages

    If my answer helped solve your issue, please mark it as accepted so that other users can find it later. Thanks!

  • Samuel Mueller
    Samuel Mueller Overachievers

    I'm don't believe you can do this with with a query.. You will likely need to loop through an array of rows and check whether both columns match your criteria's. are you using Bridge?