0

I am trying to get details from a smart sheet and when I try to connect to it I am getting the following error

{"response": {"statusCode": 404, "reason": "Not Found", "content": {"errorCode": 1006, "message": "Not Found", "refId": "1lxywzbrqxdq6"}}}
Traceback (most recent call last):
  File "smartsheet_test.py", line 36, in <module>
    sheet_details = SMARTSHEET_OBJ.Sheets.get_sheet(SHEET_ID)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/smartsheet/sheets.py", line 529, in get_sheet
    response = self._base.request(prepped_request, expected, _op)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/smartsheet/smartsheet.py", line 250, in request
    raise the_ex(native, str(native.result.code) + ': ' + native.result.message)
smartsheet.exceptions.ApiError: {"result": {"code": 1006, "errorCode": 1006, "message": "Not Found", "name": "ApiError", "recommendation": "Do not retry without fixing the problem. ", "refId": "1lxywzbrqxdq6", "shouldRetry": false, "statusCode": 404}}

This is my code

import smartsheet
from config import SHEET_ID, access_token

SMARTSHEET_OBJ = smartsheet.Smartsheet(access_token=access_token)
SMARTSHEET_OBJ.errors_as_exceptions(True)

sheet_details = SMARTSHEET_OBJ.Sheets.get_sheet(SHEET_ID)

when I looked into the documentation i found that error code 1006 means the sheet is not present I have confirmed that the sheet I am trying to access is present and the sheet id is correct Not sure what's wrong smartsheet version = 2.105.1

Tony Frank
  • 248
  • 1
  • 2
  • 8

1 Answers1

0

A 404 (Not Found) error response to a GET Sheet request is typically caused by one of three things:

  1. The request URL is malformed (i.e., the path specified isn't a valid API endpoint).
  2. The sheet ID specified does not exist.
  3. The sheet ID specified does exist, but the account (user) that owns the API access token used to issue the request does not have access to the sheet.

#1 isn't likely the culprit here -- you're using the SDK to create/issue the API request, so the request URL is presumably correct.

#2 isn't the culprit either, given that you said you've verified the sheet ID is correct (does correspond to an existing sheet in Smartsheet).

That leaves #3 -- I'd suspect that the account (user) which owns the API access token used to issue the request doesn't have access to the specified sheet in Smartsheet. You can verify this by logging into Smartsheet as the account (user) who owns the access token and check to see if you can access the sheet with the ID specified by your code. Please note that an "Admin" user in Smartsheet doesn't automatically get access to everything within that Smartsheet account -- they still need to explicitly be granted access to the objects (i.e., sheets, workspaces, etc.) that they should have access to.

Kim Brandl
  • 13,125
  • 2
  • 16
  • 21