1

I'm trying to delete a set of records using the following C# SDK Smartsheet API 2.0 method:

long[] deleteRowIds = existingRowIds.Except(updatedRowIds).ToArray();
smartsheet.SheetResources.RowResources.DeleteRows(sheetId, deleteRowIds, true)

Within the smartsheet documentation the row id parameter example is as follows:

smartsheet.SheetResources.RowResources.DeleteRows( sheetId, new long[] { 207098194749316, 207098194749317 }, true)

I hardcoded the row ids relevant to my sheet and was able to execute the method. However, when I try to push the array of Ids I'm generating in my first line of code I'm receiving this error: "There was an issue connecting".

I can't find that error in any of their documentation. Is there a chance I'm misunderstanding how my long[] variable is initialized from List by using the ToArray() method?

That's really my only theory (as I've exported all my row ids to ensure I'm not pushing an incorrect data type).

Any help would be greatly appreciated.

Thanks!

Channing

Channing
  • 129
  • 2
  • 12
  • 1
    Has anything changed about the data you are providing the method to delete rows? There is thing post here with a similar error with solutions: https://stackoverflow.com/questions/23259173/unexpected-character-encountered-while-parsing-value – daveskull81 Mar 21 '19 at 00:08
  • Data hasn't changed. I tested and it looks like I'm reaching the limit of the bulk operation. I was pushing some 3000 row ids into that array parameter, but it won't accept more than 450 in the POST. I didn't see this in the documentation, but it looks like I can bypass the issue by partitioning. – Channing Mar 21 '19 at 14:32

1 Answers1

1

Looks like the Delete method bulk operation has a limit on the amount of row ids I can pass into the long[] parameter. The limit is somewhere between 400 - 500 row ids. I'll partition these in order to bypass the limit.

Channing
  • 129
  • 2
  • 12
  • 2
    Yes. The rowIds provided are added onto the URL as comma separated query strings. Since each rowId is 16 digits long you can run into URL length maximums. I've been successful with deleting 200-300 rows at a time. Breaking up a list of rows to delete you can loop over it and delete them. You can also update all of the rows to be indented under a specific row making that row a parent of the indented ones. Deleting that parent row will then delete all of the children underneath it with it. – daveskull81 Mar 22 '19 at 17:23