I'm trying to get the update_rows method working
(the answers here haven't helped yet:
cannot update row using Smartsheet API
)
and would like to capture and parse the results
results = smartsheet.Sheets.update_rows(test_sheet_id, [row])
print(results)
gives me this:
{"requestResponse": null, "result": {"shouldRetry": false, "name":
"InvalidRowLocationError", "code": 1062, "recommendation": "Do not retry
without fixing the problem.", "message": "Invalid row location.",
"statusCode": 400}}
Note that a success looks like this (snipped most of it):
{"resultCode": 0, "message": "SUCCESS", "version": 21, "result":
[{"discussions": [], "createdAt": null, "above": null, "modifiedAt":
null, "columns": [], "toTop": null, "sheetId": null, "siblingId":
4800885606901636, "permalink": null, "id": 6067523002099588,
"accessLevel": null, "conditionalFormat": null, "attachments": [],
"cells": [{"columnType": null, "displayValue": null, "linksOutToCells":
null, "strict": true, "hyperlink": null, "formula": null, "format": null,
"conditionalFormat": null, "columnId": 7600931584927620, "linkInFromCell":
null, "value": null}, {"columnType": null, "displayValue": null, "
... snip ...
This looks like a dictionary, but the keys, items, values aren't recognized. Next it looks like json - but nothing I've tried (I don't know much about json yet) has worked either.
If I could get the resultCode from a success, that would be a start. Better would be the value from result, but that appears to be a dictionary for a fail and a list for successes.
I'm confused. Any help appreciated. I'm using Python 3.5, Smartsheet API 2.0 Python SDK
Craig
I figured it out.
returns an result object from the models\error_result.py code of the SDK.
That object has two methods of interest and each property can be referenced like so:
returns the code (1062 for example)
The two methods are to_dict and to_json which can be accessed and printed like so:
gives:
gives:
and the to_json code
gives
and:
gives: