API adding blank row instead of data sent in the code

Michael.Limanni
edited 07/18/24 in API & Developers

This is odd. I have a script that adds one row to top of a new/blank sheet for testing purposes. There are two fields and I have the column ID's as well as the sheet ID correct. When I run the script, I get a SUCCESS result. When I go to the sheet, it says it has been changed, and I need to refresh. But, there is no data. The row was added as I can now find its row ID. When I do another insert, the results come back with the sibling ID as well. Here is where it gets weird; when I filter non-blank cells for the one I sent over, I lose row 1 due to the filter, but the browser says "0 of 0 meet filter conditions." Lastly, the modified by and modified date are blank. It is not a formatting issue (color or otherwise). The field is truly blank. Thoughts? In the below script I am using a string for one columnID and one from the array just to make sure that wasn't the issue.

$apiToken = "BLAHBLAHBLAH"

$headers = @{    "Authorization" = "Bearer $apiToken"    "Content-Type" = "application/json"}

$summarySheetId = "3293997325832068"$summaryColumnIds = @("5079686234460036", "576086607089540") # Update with actual column IDs for summary data


$cells = @(    @{        "columnId" = "5079686234460036"        "value" = "Limanni"    },    @{        "columnId" = $summaryColumnIds[1]        "value" = "SOW - Test"    })


$row = @{    "toBottom" = $true    "cells" = $cells}
$body = @{    "toBottom" = $true    "rows" = @($row)

} | ConvertTo-Json -Depth 3


$updateUrl = "https://api.smartsheet.com/2.0/sheets/$summarySheetId/rows"

$response = Invoke-RestMethod -Uri $updateUrl -Headers $headers -Body $body -Method Post

# Output the response for debugging

$response | ConvertTo-Json -Depth 3

Answers

  • Any thoughts? I did add ";" at the end of some of the lines where they might be missing. It didn't change the outcome. Same as I wrote earlier. Please offer any suggestions to help move this along…

  • Isaac A.
    Isaac A. Employee

    Hi @Michael.Limanni!

    I recommend using Postman to test your API calls and see if the issue persists. This can help identify if the problem is with your script or with the API itself.

    For your information, currently, Smartsheet Support does not handle SDK-related inquiries. If you’ve tested and found an issue with the SDK, please report it on the relevant GitHub page. You can access the links to these pages in our API documentation here: Smartsheet API Documentation.

    Should you not get a response from the Community, consider checking out StackOverflow to connect with other developers for more help.

    Cheers,

    Isaac.

    Join us at Smartsheet ENGAGE 2024🎉

    October 8 - 10, Seattle, WA | Register now

  • Good morning,

    I am having the same exact problem. It happens when I send a POST request via Workato recipe. I also tested using Postman and it happens there as well. The below is what I tested via Postman. It returns success, but the rows are blank in the sheet.

    {    "array": [        {            "cells": [                {                    "columnId": "7289649201631108",                    "value": "251632"                },                {                    "columnId": "6357263341277060",                    "value": "19520724"                },                {                    "columnId": "1660149667417988",                    "value": "Active"                }            ],            "toBottom": "true"        },        {            "cells": [                {                    "columnId": "7289649201631108",                    "value": "251634"                },                {                    "columnId": "6357263341277060",                    "value": "19520726"                },                {                    "columnId": "1660149667417988",                    "value": "Active"                }            ],            "toBottom": "true"        },        {            "cells": [                {                    "columnId": "7289649201631108",                    "value": "251635"                },                {                    "columnId": "6357263341277060",                    "value": "19520727"                },                {                    "columnId": "1660149667417988",                    "value": "Active"                }            ],            "toBottom": "true"        }    ]}

  • Sounds like a bug to me. Any thoughts from the Smartsheet team?