Error 404 When Trying to Delete Rows Using API - "Not Found" Issue

Hi Smartsheet Community,

I'm encountering a 404 Not Found error while attempting to delete rows using the Smartsheet API, and I would appreciate some guidance to resolve this issue.

Context:

I am trying to delete specific rows from a Smartsheet using the Python SDK as well as testing with a direct curl command. Here are the relevant details:

  • Sheet ID: V3cVwC6xQvmfVPrgWhxrGQ929vrhgJ23vjPJq621
  • Row IDs: ["2520121729585028", "6974708607307652"]

Here is the curl command I'm using:

bashCopy codecurl -X DELETE "https://api.smartsheet.com/2.0/sheets/V3cVwC6xQvmfVPrgWhxrGQ929vrhgJ23vjPJq621/rows?ids=2520121729585028,6974708607307652" \  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \  -H "Content-Type: application/json"

Issue:

  • { "response": { "statusCode": 404, "reason": "Not Found", "content": { "errorCode": 1006, "message": "Not Found", "refId": "037f8039-eb04-47a0-8e3c-539b9984f90d" } }}
  • Similar behavior occurs when using the Python SDK (smartsheet_client.Sheets.delete_rows(sheet_id, row_ids)).

Troubleshooting Steps Taken:

  1. Verified Sheet ID and Row IDs: The IDs used are correct to the best of my knowledge.
  2. Fetched Sheet Before Deletion: I re-fetched the sheet to confirm that the rows are still present before issuing the delete request.
  3. Checked Permissions: I'm the OWNER of the Sheet.

Questions:

  1. Is there a specific reason why the rows might not be found? Is it possible that rows can become inaccessible for deletion even though they are visible in the sheet?
  2. Is there a different method or endpoint I should use for deleting multiple rows that could help avoid this error?
  3. Is there any caching behavior or synchronization delay that might be causing the sheet to report these rows as "not found"?

Any help or suggestions on what could be causing this error or further troubleshooting steps would be greatly appreciated.

Thanks in advance for your assistance!

Answers

  • jmyzk_cloudsmart_jp
    jmyzk_cloudsmart_jp ✭✭✭✭✭✭

    Hi @techguy

    The Sheet ID format in the given example is likely incorrect. Smartsheet's Sheet ID is typically a numerical value (e.g., 1234567891223) and not an alphanumeric string as shown (V3cVwC6xQvmfVPrgWhxrGQ929vrhgJ23vjPJq621). This error could very well be the reason why the API call results in a 404 Not Found error. Let’s break it down:

    Why the Sheet ID format matters

    1. Smartsheet API specification: The API expects the Sheet ID to be a valid numerical ID. An incorrect ID, such as the alphanumeric string in the example, would not map to an existing sheet in the Smartsheet system.
    2. Mismatch with API documentation: The Sheet ID provided (V3cVwC6xQvmfVPrgWhxrGQ929vrhgJ23vjPJq621) looks like a component of the sheet's URL rather than the actual Sheet ID. This suggests the user has mistakenly used a different identifier.

    Correct steps to verify the Sheet ID

    The user should:

    • Use the Smartsheet UI to find the correct Sheet ID:
    1. Open the sheet in Smartsheet.
    2. From the munu, click File > Properties to find Sheet ID.
    • Alternatively, retrieve the Sheet ID programmatically

    List Sheets

    reponse = smartsheet_client.Sheets.list_sheets(include_all=True) 
    
    sheets = response.data
    

    The response will include the correct numerical Sheet ID for each sheet.