Skip to content
This repository has been archived by the owner on Jan 9, 2023. It is now read-only.

Getting error code 5536 while performing add_rows #167

Open
bharatsangale1 opened this issue Jul 19, 2021 · 1 comment
Open

Getting error code 5536 while performing add_rows #167

bharatsangale1 opened this issue Jul 19, 2021 · 1 comment

Comments

@bharatsangale1
Copy link

While adding rows in smartsheet, getting error like below
{"code": 5536, "errorCode": 5536, "message": "The value "2021-07-19T11:09:15.985641" could not be saved in column "COLUMN_NAME". This column is restricted to DATE values only.", "name": "ApiError", "recommendation": "Do not retry without fixing the problem. ", "refId": "34we3p681175", "shouldRetry": false, "statusCode": 400}

In Smartsheet, there is on column od type "Date" and also has "restrict to dates" checkbox checked. It is requirement.
As per API doc,
The Smartsheet API returns all dates and times in the UTC time zone in ISO-8601 format, that is, YYYY-MM-DDTHH:MM:SSZ. If you are specifying a date and time, you should also send that information in ISO-8601 format.

By using Python, I am sending date in ISO format only but still getting exception.
Python Code: datetime.now().isoformat()

Can anyone please help me in this case? Am I missing anything?

@RCoff
Copy link
Contributor

RCoff commented Sep 13, 2021

Please try appending a 'Z' onto the end of your datetime.

Also ensure that you're using UTC time instead of local time. This can be accomplished using:
datetime.utcnow().isoformat() or datetime.now(timezone.utc).isoformat()

Your code should look something like: f"{datetime.utcnow().isoformat()}Z"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants