So me and the Python SDK is having a bit of a disagreement about updating projectSettings of a sheet and the SDK just gives me an error (the audacity!).
Reading the API docs (https://smartsheet-platform.github.io/api-docs/?python#projectsettings-object) my interpretation is this:
nonWorkingDays: "...The format for the timestamp array must be an array of strings that are valid ISO-8601 dates ('YYYY-MM-DD')."
workingDays: "...Valid values must be an array of strings of days of the week..."
is that both wants a list of strings when using the SDK.
So I tried with this:
updated_sheet = smartsheet_client.Sheets.update_sheet(
SMARTSHEET_ID,
smartsheet.models.Sheet({
'project_settings': smartsheet.models.ProjectSettings({
'working_days': ['MONDAY', 'TUESDAY', 'WEDNESDAY', 'THURSDAY', 'FRIDAY']
})
})
)
Works flawlessly and exactly how I would expect it. Strengthend by this I tried with this:
updated_sheet = smartsheet_client.Sheets.update_sheet(
SMARTSHEET_ID,
smartsheet.models.Sheet({
'project_settings': smartsheet.models.ProjectSettings({
'non_working_days': ['2020-10-30', '2020-12-23']
})
})
)
But instead of another success I get greated by this error:
{"response": {"statusCode": 400, "reason": "Bad Request", "content": {"errorCode": 1008, "message": "Unable to parse request. The following error occurred: Field \"null\" was of unexpected type.", "refId": "ozjgdl26up89"}}}
Traceback (most recent call last):
File "smartsheet_holidays.py", line 50, in <module>
'non_working_days': ['2020-10-30', '2020-12-23']
File "/mnt/c/Users/sni/Documents/TempDev/PythonHolidays3.6/lib/python3.6/site-packages/smartsheet/sheets.py", line 1110, in update_sheet
response = self._base.request(prepped_request, expected, _op)
File "/mnt/c/Users/sni/Documents/TempDev/PythonHolidays3.6/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": 1008, "errorCode": 1008, "message": "Unable to parse request. The following error occurred: Field \"null\" was of unexpected type.", "name": "ApiError", "recommendation": "Do not retry without fixing the problem. ", "refId": "ozjgdl26up89", "shouldRetry": false, "statusCode": 400}}
Either I'm too stupid too understand the API docs, too bad at Python or something else is going on. All scenarios are entirly plausible but regardless I'm stuck and very much appreciate som pointers on where I'm going wrong.