Smartsheet api call in python.
Hi im trying to use the smart sheet API in Python with the following code.#Establishes a connection to smart = smartsheet.Smartsheet(api_base="https://api.smartsheet.eu/2.0/sheets", access_token="MYTOKEN")
smart.assume_user("MYEMAIL")
#Establishes link to the time off requests
smartsheetsheet_id = "MYSHEETID"
sheet = smart.Sheets.get_sheet(sheet_id) print(sheet)
But I am receiving the following error.
{"response": {"statusCode": 401, "reason": "Unauthorized", "content": {"errorCode": 1030, "message": "You are unable to assume the user specified.", "refId": "knzehm"}}}
{"result": {"code": 1030, "errorCode": 1030, "message": "You are unable to assume the user specified.", "name": "ApiError", "recommendation": "Do not retry without fixing the problem. ", "refId": "knzehm", "shouldRetry": false, "statusCode": 401}}
Is this possibly due to our organisation using single sign on? In any event any help you could provide would be appreciated.
Best Answer
-
Hi Genevieve,
I have since fixed this issue. It was a combination of the code being wrong and my account not being set up as a Developer on the EU environment the first one was fixed with the below code change.
smart = smartsheet.Smartsheet(api_base="https://api.smartsheet.eu/2.0/", access_token="MYAPIKEY")
sheet_id = "MYSHEETID"
sheet = smart.Sheets.get_sheet(sheet_id)
and the second one was just a simple request to the staff at Smartsheet, hope this can help other developers.
Answers
-
Hi @Kezanub
Can you clarify what user you're looking to "assume"? An admin cannot impersonate another admin, is it possible the account is an admin account? Here's more information:
This other Community post has more examples of assume user:
This conversation in StackOverflow may be useful to you as well:
Cheers,
GenevieveNeed more help? 👀 | Help and Learning Center
こんにちは (Konnichiwa), Hallo, Hola, Bonjour, Olá, Ciao! 👋 | Global Discussions
-
Hi Genevieve,
I have since fixed this issue. It was a combination of the code being wrong and my account not being set up as a Developer on the EU environment the first one was fixed with the below code change.
smart = smartsheet.Smartsheet(api_base="https://api.smartsheet.eu/2.0/", access_token="MYAPIKEY")
sheet_id = "MYSHEETID"
sheet = smart.Sheets.get_sheet(sheet_id)
and the second one was just a simple request to the staff at Smartsheet, hope this can help other developers.
Categories
- All Categories
- 14 Welcome to the Community
- Smartsheet Customer Resources
- 64.2K Get Help
- 419 Global Discussions
- 221 Industry Talk
- 461 Announcements
- 4.8K Ideas & Feature Requests
- 143 Brandfolder
- 141 Just for fun
- 58 Community Job Board
- 462 Show & Tell
- 32 Member Spotlight
- 1 SmartStories
- 299 Events
- 38 Webinars
- 7.3K Forum Archives