如何提交“无效请求[0].updateTextStyle:'fields' 中必须至少列出一个字段。 (使用'*'表示所有字段。)">'
How to file 'Invalid requests[0].updateTextStyle: At least one field must be listed in 'fields'. (Use '*' to indicate all fields.)">'
我正在尝试更新 google 文档,当我尝试推送更新时它说 googleapiclient.errors.HttpError: <HttpError 400 when requesting https://docs.googleapis.com/v1/documents/1UeorM9adOh8Nds1Z457RRKBZMkh0VZ_kn_jllpkzh7U:batchUpdate?alt=json returned "Invalid requests[0].updateTextStyle: At least one field must be listed in 'fields'. (Use '*' to indicate all fields.)">
我不知道这是什么意思。
这是抛出错误的方法
def update(request):
result = service.documents().batchUpdate(
documentId=DOCUMENT_ID, body={'requests': [request]}).execute()
return result
如果有人能提供帮助那就太好了!
这就是我的要求
request = {
'updateTextStyle': {
'range': {
'segmentId': None,
'startIndex': None, # gets filled with the proper number
'endIndex': None # gets filled with the proper number
},
'textStyle': {
"bold": False,
"italic": False,
"underline": False,
"strikethrough": False,
"smallCaps": False,
"backgroundColor": {
'color': {
'rgbColor': {
'red': 0.2,
'green': 0.2,
'blue': 0.2
}
}
},
"foregroundColor": {
'color': {
'rgbColor': {
'red': 0.96,
'green': 0.96,
'blue': 0.96
}
}
},
"fontSize": {
'magnitude': 10,
'unit': 'PT'
},
"weightedFontFamily": {
'fontFamily': 'Courier New OS',
'weight': 400
},
"baselineOffset": 'NONE',
"link": None
}
}
}
At least one field must be listed in 'fields'. (Use '*' to indicate all fields.)
表示你的请求体中没有设置fields
的属性。那么比如这个修改怎么样?
发件人:
},
"baselineOffset": 'NONE',
"link": None
}
}
}
收件人:
},
"baselineOffset": 'NONE',
"link": None
},
"fields": "*" # Added
}
}
注:
- 此答案假定您已经能够使用 Google 文档 API.
更新 Google 文档
- 此修改假设当您使用此请求正文时,
'range': {'segmentId': None, 'startIndex': None, 'endIndex': None},
和 "link": None
中的 None
被替换为正确的值。
参考:
我正在尝试更新 google 文档,当我尝试推送更新时它说 googleapiclient.errors.HttpError: <HttpError 400 when requesting https://docs.googleapis.com/v1/documents/1UeorM9adOh8Nds1Z457RRKBZMkh0VZ_kn_jllpkzh7U:batchUpdate?alt=json returned "Invalid requests[0].updateTextStyle: At least one field must be listed in 'fields'. (Use '*' to indicate all fields.)">
我不知道这是什么意思。
这是抛出错误的方法
def update(request):
result = service.documents().batchUpdate(
documentId=DOCUMENT_ID, body={'requests': [request]}).execute()
return result
如果有人能提供帮助那就太好了!
这就是我的要求
request = {
'updateTextStyle': {
'range': {
'segmentId': None,
'startIndex': None, # gets filled with the proper number
'endIndex': None # gets filled with the proper number
},
'textStyle': {
"bold": False,
"italic": False,
"underline": False,
"strikethrough": False,
"smallCaps": False,
"backgroundColor": {
'color': {
'rgbColor': {
'red': 0.2,
'green': 0.2,
'blue': 0.2
}
}
},
"foregroundColor": {
'color': {
'rgbColor': {
'red': 0.96,
'green': 0.96,
'blue': 0.96
}
}
},
"fontSize": {
'magnitude': 10,
'unit': 'PT'
},
"weightedFontFamily": {
'fontFamily': 'Courier New OS',
'weight': 400
},
"baselineOffset": 'NONE',
"link": None
}
}
}
At least one field must be listed in 'fields'. (Use '*' to indicate all fields.)
表示你的请求体中没有设置fields
的属性。那么比如这个修改怎么样?
发件人:
},
"baselineOffset": 'NONE',
"link": None
}
}
}
收件人:
},
"baselineOffset": 'NONE',
"link": None
},
"fields": "*" # Added
}
}
注:
- 此答案假定您已经能够使用 Google 文档 API. 更新 Google 文档
- 此修改假设当您使用此请求正文时,
'range': {'segmentId': None, 'startIndex': None, 'endIndex': None},
和"link": None
中的None
被替换为正确的值。