smartsheet-api

What is the correct formatting for an HTTP Request for multiple rows with location specifiers?


I am experiencing an issue with trying to utilize the add_rows API endpoint with:

  1. Multiple rows
  2. Location specifiers

This is my Body Request fed into Power Automate - trying to add 2 rows, both are to be at the bottom of an existing parentId (different parentId):

{
    "uri": "https://api.smartsheet.com/2.0/sheets/<sheetID>/rows",
    "method": "POST",
    "headers": {
        "Authorization": "*sanitized*",
        "Content-Type": "application/json"
    },
    "body": [
        {
            "rows": [
                {
                    "parentId": 3549566531080068,
                    "toBottom": true,
                    "cells": [
                        {
                            "columnId": 5365531952238468,
                            "value": "test1"
                        },
                        {
                            "columnId": 7617331765923716,
                            "objectValue": {
                                "objectType": "MULTI_PICKLIST",
                                "values": [
                                    "team1",
                                    "team2"
                                ]
                            }
                        }
                    ]
                },
                {
                    "parentId": 3865014262894468,
                    "toBottom": true,
                    "cells": [
                        {
                            "columnId": 5365531952238468,
                            "value": "Test"
                        }
                    ]
                }
            ]
        }
    ]
}

The response I get is not as expected in 3 ways:

  1. Only one row is confirmed to added
  2. The specified location is ignored and it is added at the bottom of the sheet and not the bottom of the parentId
  3. None of the desired columns are filled in.

RESPONSE

    {
    "statusCode": 200,
    "headers": {
        ...
    },
    "body": {
        "message": "SUCCESS",
        "resultCode": 0,
        "version": 93,
        "result": [
            {
                "id": xxxxxxx,
                "sheetId": xxxxxxx,
                "rowNumber": 133,      #this is the bottom of the row, whereas the parentId I specified is row ~101
                "siblingId": 8611906339278724,
                "expanded": true,
                "locked": false,
                "lockedForUser": false,
                "createdAt": "2025-10-21T21:52:08Z",
                "modifiedAt": "2025-10-21T21:52:08Z",
                "cells": [
                    {
                        "columnId": 963702111817604
                    },
                    {
                        "columnId": 4931695829274500
                    },
                    {
                        "columnId": 8801951526113156
                    },
                    {
                        "columnId": 216964736438148
                    },
                    {
                        "columnId": 5365531952238468
                    },
                    {
                        "columnId": 6649929574076292
                    },
                    {
                        "columnId": 2146329946705796
                    },
                    {
                        "columnId": 4028693853458308
                    },
                    {
                        "columnId": 3113732138553220
                    },
                    {
                        "columnId": 7617331765923716
                    },
                    {
                        "columnId": 1987832231710596
                    },
                    {
                        "columnId": 7775829480918916
                    },
                    {
                        "columnId": 4398129760391044
                    },
                    {
                        "columnId": 8901729387761540
                    },
                    {
                        "columnId": 105636365553540
                    },
                    {
                        "columnId": 6420724013813636
                    }
                ]
            }
        ]
    }
}

Checks I've completed


Solution

  • I'm unable to reproduce the erroneous response that you've described -- but I can provide some guidance nonetheless.

    My sheet initially looks like this (2 columns, 2 rows):

    sheet initial state

    I'll start by sending a Get Sheet request, to see the JSON format of the sheet before I attempt to make any changes:

    GET https://api.smartsheet.com/2.0/sheets/2702602705784708
    

    The Get Sheet response (edited to remove excess/irrelevant info) looks like this:

    {
        "id": 2702602705784708,
        ...
        "columns": [
            {
                "id": 1330564984426372,
                "index": 0,
                "primary": true,
                "title": "ID",
                "type": "TEXT_NUMBER",
                ...
            },
            {
                "id": 5834164611796868,
                "index": 1,
                "title": "color",
                "type": "TEXT_NUMBER",
                ...
            }
        ],
        ...
        "rows": [
            {
                "id": 8807758496862084,
                "rowNumber": 1,
                ...
                "cells": [
                    {
                        "columnId": 1330564984426372,
                        "displayValue": "A",
                        "value": "A"
                    },
                    {
                        "columnId": 5834164611796868,
                        "displayValue": "BLUES",
                        "value": "BLUES"
                    }
                ]
            },
            {
                "id": 198062507724676,
                "rowNumber": 2,
                "siblingId": 8807758496862084,
                ...
                "cells": [
                    {
                        "columnId": 1330564984426372,
                        "displayValue": "B",
                        "value": "B"
                    },
                    {
                        "columnId": 5834164611796868,
                        "displayValue": "REDS",
                        "value": "REDS"
                    }
                ]
            }
        ],
        "totalRowCount": 2,
        ...
    }
    

    This response provides the ID values that I need for my Add Rows request.

    Next, I send the Add Rows request -- attempting to add 2 new (child) rows to the sheet:

    Here's that Add Rows request (using the same scenario as you posted -- a different parentId for each new row, both rows with the toBottom attribute set to true):

    POST https://api.smartsheet.com/2.0/sheets/2702602705784708/rows
    
    [
        {
            "parentId": 8807758496862084,
            "toBottom": true,
            "cells": [
                {
                    "columnId": 1330564984426372,
                    "value": "child-id-1"
                },
                {
                    "columnId": 5834164611796868,
                    "value": "child-value-1"
                }
            ]
        },
        {
            "parentId": 198062507724676,
            "toBottom": true,
            "cells": [
                {
                    "columnId": 1330564984426372,
                    "value": "child-id-2"
                },
                {
                    "columnId": 5834164611796868,
                    "value": "child-value-2"
                }
            ]
        }
    ]
    

    Here's the response that's returned when I send this request:

    {
        "refId": "2c4867d2-10e1-4a81-b2b4-a165a3716f84",
        "errorCode": 1123,
        "message": "Specifying multiple row locations is not yet supported. Each row must use the same row location attribute and value (toBottom, toTop, parentId, siblingId, above)",
        "detail": {
            "index": 1
        }
    }
    

    This means that all rows within my Add Rows request must have the exact same row location attributes with the exact same values. My Add Rows request failed because it attempted to add child rows under two different 'parent' rows in the sheet (i.e., different parentId attribute value specified for each of the two rows in the Add Rows request).

    To verify that this is what caused the problem -- I will send another Add Rows request -- this time specifying the same parentId attribute value for both new rows in the request -- in this example, I'll try to add both new rows under the second row in the sheet:

    POST https://api.smartsheet.com/2.0/sheets/2702602705784708/rows
    
    [
        {
            "parentId": 198062507724676,
            "toBottom": true,
            "cells": [
                {
                    "columnId": 1330564984426372,
                    "value": "child-id-1"
                },
                {
                    "columnId": 5834164611796868,
                    "value": "child-value-1"
                }
            ]
        },
        {
            "parentId": 198062507724676,
            "toBottom": true,
            "cells": [
                {
                    "columnId": 1330564984426372,
                    "value": "child-id-2"
                },
                {
                    "columnId": 5834164611796868,
                    "value": "child-value-2"
                }
            ]
        }
    ]
    

    This request succeeds and returns the following response (edited to remove excess/irrelevant attributes):

    {
        "message": "SUCCESS",
        "resultCode": 0,
        "version": 90,
        "result": [
            {
                "id": 2555230536929156,
                "sheetId": 2702602705784708,
                "rowNumber": 3,
                ...
                "cells": [
                    {
                        "columnId": 1330564984426372,
                        "displayValue": "child-id-1",
                        "value": "child-id-1"
                    },
                    {
                        "columnId": 5834164611796868,
                        "displayValue": "child-value-1",
                        "value": "child-value-1"
                    }
                ],
                "parentId": 198062507724676
            },
            {
                "id": 7058830164299652,
                "sheetId": 2702602705784708,
                "rowNumber": 4,
                "siblingId": 2555230536929156,
                ...
                "cells": [
                    {
                        "columnId": 1330564984426372,
                        "displayValue": "child-id-2",
                        "value": "child-id-2"
                    },
                    {
                        "columnId": 5834164611796868,
                        "displayValue": "child-value-2",
                        "value": "child-value-2"
                    }
                ],
                "parentId": 198062507724676
            }
        ]
    }
    

    As expected, my sheet now looks like the following (both new rows added as child rows under the same parent row in the sheet, as specified by the Add Rows request):

    enter image description here

    So, to accomplish your goal -- wanting to add multiple new rows to a sheet, but at different locations within the sheet (i.e., under different parent rows) -- you'll need to issue a separate Add Rows request for each location where you want to add rows. For example, if you wanted to add a total of 5 new rows to a sheet -- 2 rows under one parent row and 3 rows under a different parent row -- you'd need to issue two separate Add Rows requests: