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
- Customer Resources
- 64.8K Get Help
- 438 Global Discussions
- 138 Industry Talk
- 470 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 67 Community Job Board
- 486 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives