使用python库和2.0API文档。我正在尝试添加一行,但一直收到错误:"message": "Required object attribute(s) are missing from your request: row.id."
问题似乎出在new_row.to_bottom=True
语句上。是我理解错误了,还是API中有错误?我还注意到,当我在同一个调用中添加to_top
时,返回的消息是only toTop or toBottom in a single call.
,我再次尝试了该语法,但仍然没有成功。
import smartsheet
...
new_row = ss_client.models.Row()
new_row.to_bottom = True #also tried .toBottom=True
new_cell = ss_client.models.Cell()
new_cell.column_id = 9380123454964
new_cell.value = 'update'
new_cell.strict = False
new_row.cells.append(new_cell)
updated_row = ss_client.Sheets.update_rows(1234567,[new_row]) #also tried new_row outside of []
Response: {
status: 400 Bad Request
content: {
{
"detail": {
"index": 0
},
"errorCode": 1012,
"message": "Required object attribute(s) are missing from your request: row.id.",
"refId": "152g54q6e89sd"
}
}
有人知道怎么解决这个问题吗?SDK还在1.0版本还是什么版本?
发布于 2018-12-06 04:14:24
您正在尝试更新尚不存在的行。在实际创建行之前,您不知道行id是什么,因为服务器还没有为它分配一个id。用add_rows
替换update_rows
。
ss_client.Sheets.add_rows(<sheet_id>,[new_row])
https://stackoverflow.com/questions/53626594
复制相似问题