{"action":"created","issue":{"url":"https://api.github.com/repos/smartsheet-platform/smartsheet-python-sdk/issues/4","labels_url":"https://api.github.com/repos/smartsheet-platform/smartsheet-python-sdk/issues/4/labels{/name}","comments_url":"https://api.github.com/repos/smartsheet-platform/smartsheet-python-sdk/issues/4/comments","events_url":"https://api.github.com/repos/smartsheet-platform/smartsheet-python-sdk/issues/4/events","html_url":"https://github.com/smartsheet-platform/smartsheet-python-sdk/issues/4","id":73414378,"number":4,"title":"Null date fields","user":{"login":"tberg","id":3097721,"avatar_url":"https://avatars.githubusercontent.com/u/3097721?v=3","gravatar_id":"","url":"https://api.github.com/users/tberg","html_url":"https://github.com/tberg","followers_url":"https://api.github.com/users/tberg/followers","following_url":"https://api.github.com/users/tberg/following{/other_user}","gists_url":"https://api.github.com/users/tberg/gists{/gist_id}","starred_url":"https://api.github.com/users/tberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tberg/subscriptions","organizations_url":"https://api.github.com/users/tberg/orgs","repos_url":"https://api.github.com/users/tberg/repos","events_url":"https://api.github.com/users/tberg/events{/privacy}","received_events_url":"https://api.github.com/users/tberg/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-05T19:50:23Z","updated_at":"2015-05-05T22:18:48Z","closed_at":null,"body":"* Adding a new row containing a DATE cell with the value of None results in the following error: APIRequestError status: 400  error_code: 1042  message: u'The value for cell in column 1539813489829764, None, did not conform to the strict requirements for type DATE.'\r\n* Adding a new row containing a DATE cell with the value of \"\" results in a DATE cell with the value of None.\r\n* An existing row with a DATE cell can have the date value set to None, and when the cell value is fetched it will be None.\r\n* An existing row with a DATE cell can have the date value set to \"\", and when the cell value is fetched it will be \"\"."},"comment":{"url":"https://api.github.com/repos/smartsheet-platform/smartsheet-python-sdk/issues/comments/99249005","html_url":"https://github.com/smartsheet-platform/smartsheet-python-sdk/issues/4#issuecomment-99249005","issue_url":"https://api.github.com/repos/smartsheet-platform/smartsheet-python-sdk/issues/4","id":99249005,"user":{"login":"tberg","id":3097721,"avatar_url":"https://avatars.githubusercontent.com/u/3097721?v=3","gravatar_id":"","url":"https://api.github.com/users/tberg","html_url":"https://github.com/tberg","followers_url":"https://api.github.com/users/tberg/followers","following_url":"https://api.github.com/users/tberg/following{/other_user}","gists_url":"https://api.github.com/users/tberg/gists{/gist_id}","starred_url":"https://api.github.com/users/tberg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tberg/subscriptions","organizations_url":"https://api.github.com/users/tberg/orgs","repos_url":"https://api.github.com/users/tberg/repos","events_url":"https://api.github.com/users/tberg/events{/privacy}","received_events_url":"https://api.github.com/users/tberg/received_events","type":"User","site_admin":false},"created_at":"2015-05-05T22:18:48Z","updated_at":"2015-05-05T22:18:48Z","body":"Sorry, didn't see this until just now\n\nOn Tue, May 5, 2015 at 2:12 PM, Scott Wimer <notifications@github.com>\nwrote:\n\n> Please send the script. That's looking like an odd situation.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/smartsheet-platform/smartsheet-python-sdk/issues/4#issuecomment-99223085>\n> .\n>\n\n#!/usr/bin/env python\r\nimport requests\r\nimport json\r\nimport sys\r\n\r\nSTRICT = True\r\n\r\ndef short_circuit(r):\r\n  print r\r\n  print r.text\r\n  if r.status_code != 200:\r\n    sys.exit(r.status_code)\r\n\r\ndef banner(text):\r\n  print\r\n  width = 80\r\n  spare = width - 2 - len(text)\r\n  pad = '#' * (spare / 2)\r\n  txt = '{0} {1} {0}'.format(pad, text)\r\n  print txt\r\n\r\ntoken = \"1icmy25o4qyx09rv8rq78svmxe\"\r\nheaders = {\r\n  'Authorization' : 'Bearer %s' % token,\r\n  'Content-type'  : 'application/json',\r\n}\r\n\r\n# create a temp sheet\r\n# needs a date column\r\n\r\nsheet_name = 'Date Checker Sheet, Discard'\r\n\r\ncolumns = [\r\n  {'title': 'Primary Key', 'type': 'TEXT_NUMBER', 'primary': True},\r\n  {'title': 'Date', 'type': 'DATE'},\r\n  {'title': 'Value', 'type': 'TEXT_NUMBER'}\r\n]\r\n\r\nsheet_conf = {\r\n  'name': sheet_name,\r\n  'columns' : columns,\r\n}\r\n\r\nbanner(\"Creating Sheet\")\r\nr = requests.post('https://api.smartsheet.com/1.1/sheets', headers=headers, data=json.dumps(sheet_conf))\r\nshort_circuit(r)\r\n\r\nsheet_info = r.json()\r\nsheet_id = sheet_info['result']['id']\r\ncolumn_ids = {}\r\nfor i in sheet_info['result']['columns']:\r\n  id = i['id']\r\n  index = i['index']\r\n  column_ids[index] = id\r\n\r\n# add a row with a null date\r\ndata = {\r\n  'toBottom': True,\r\n  'rows': [\r\n    {\r\n      'cells': [\r\n        {'columnId': column_ids[0], 'value': None, 'strict': STRICT},\r\n        {'columnId': column_ids[1], 'value': None, 'strict': STRICT},\r\n        {'columnId': column_ids[2], 'value': None, 'strict': STRICT}\r\n      ],\r\n    },      \r\n  ],\r\n}\r\n\r\nbanner(\"Adding Null date row\")\r\nr = requests.post('https://api.smartsheet.com/1.1/sheet/{0}/rows'.format(sheet_id), headers=headers, data=json.dumps(data))\r\nshort_circuit(r)\r\n\r\n# add a row with a '' date\r\ndata = {\r\n  'toBottom': True,\r\n  'rows': [\r\n    {\r\n      'cells': [\r\n        {'columnId': column_ids[0], 'value': '', 'strict': STRICT},\r\n        {'columnId': column_ids[1], 'value': '', 'strict': STRICT},\r\n        {'columnId': column_ids[2], 'value': '', 'strict': STRICT}\r\n      ],\r\n    },      \r\n  ],\r\n}\r\n\r\nbanner(\"Adding empty date row\")\r\nr = requests.post('https://api.smartsheet.com/1.1/sheet/{0}/rows'.format(sheet_id), headers=headers, data=json.dumps(data))\r\nshort_circuit(r)\r\n\r\n# check the value of the date in row 1\r\nbanner(\"Fetching row Null row\")\r\nr = requests.get('https://api.smartsheet.com/1.1/sheet/{0}/row/{1}'.format(sheet_id, 1), headers=headers)\r\nshort_circuit(r)\r\n\r\n# check the value of the date in row 2\r\nbanner(\"Fetching row Empty row\")\r\nr = requests.get('https://api.smartsheet.com/1.1/sheet/{0}/row/{1}'.format(sheet_id, 2), headers=headers)\r\nshort_circuit(r)\r\n\r\n# Delete the sheet\r\nbanner(\"Deleting sheet\")\r\nr = requests.delete('https://api.smartsheet.com/1.1/sheet/{0}'.format(sheet_id), headers=headers)\r\nshort_circuit(r)\r\n\r\n\r\n"}}