Google 文档 API (JavaScript) - batchUpdate - updateTextStyle foregroundColor returns 500?
Google Doc API (JavaScript) - batchUpdate - updateTextStyle foregroundColor returns 500?
我有一个应用程序可以生成文档副本,然后 运行 对新文件进行批量更新。尝试使用 updateTextStyle 时,我不断收到 500 错误,但没有太多细节。我的整个请求 returns 没有前景颜色就可以了,包括插入一个 table 和多个替换文本请求。
通过试用功能在基本文本文档上执行此操作时也会出现此错误。
对于最简单的示例,使用 Google Docs API Try It,我 运行 在我的根目录中创建的空白 google 文档中使用文本 'TEST COLOR CHANGE GOOGLE DOC' 和没有别的。
我执行的代码:
{
"requests": [
{
"updateTextStyle": {
"fields": "foregroundColor",
"range": {
"startIndex": 1,
"endIndex": 3,
},
"textStyle": {
"foregroundColor": {
"color": {
"rgbColor": {
"blue": 255,
"green": 0,
"red": 0
}
}
}
}
}
}
]
}
返回错误:
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
我尝试了各种方法,但似乎没有任何效果。感谢您的帮助!
- 您想使用 Google 文档 API 中 documents.batchUpdate 的方法修改
foregroundColor
。
如果我的理解是正确的,这个修改怎么样?
我认为您的请求正文大部分是正确的。但是关于rgbColor
,请修改如下。我认为您的错误消息是由于此造成的。在the official document中表示如下。
- red: The red component of the color, from 0.0 to 1.0.
- green: The green component of the color, from 0.0 to 1.0.
- blue: The blue component of the color, from 0.0 to 1.0.
据此,请修改您请求正文中rgbColor
的属性如下。
发件人:
"rgbColor": {
"blue": 255,
"green": 0,
"red": 0
}
收件人:
"rgbColor": {
"blue": 1,
"green": 0,
"red": 0
}
参考:
如果我误解了你的问题,这不是你想要的结果,我深表歉意。
我有一个应用程序可以生成文档副本,然后 运行 对新文件进行批量更新。尝试使用 updateTextStyle 时,我不断收到 500 错误,但没有太多细节。我的整个请求 returns 没有前景颜色就可以了,包括插入一个 table 和多个替换文本请求。
通过试用功能在基本文本文档上执行此操作时也会出现此错误。
对于最简单的示例,使用 Google Docs API Try It,我 运行 在我的根目录中创建的空白 google 文档中使用文本 'TEST COLOR CHANGE GOOGLE DOC' 和没有别的。
我执行的代码:
{
"requests": [
{
"updateTextStyle": {
"fields": "foregroundColor",
"range": {
"startIndex": 1,
"endIndex": 3,
},
"textStyle": {
"foregroundColor": {
"color": {
"rgbColor": {
"blue": 255,
"green": 0,
"red": 0
}
}
}
}
}
}
]
}
返回错误:
{
"error": {
"code": 500,
"message": "Internal error encountered.",
"status": "INTERNAL"
}
}
我尝试了各种方法,但似乎没有任何效果。感谢您的帮助!
- 您想使用 Google 文档 API 中 documents.batchUpdate 的方法修改
foregroundColor
。
如果我的理解是正确的,这个修改怎么样?
我认为您的请求正文大部分是正确的。但是关于rgbColor
,请修改如下。我认为您的错误消息是由于此造成的。在the official document中表示如下。
- red: The red component of the color, from 0.0 to 1.0.
- green: The green component of the color, from 0.0 to 1.0.
- blue: The blue component of the color, from 0.0 to 1.0.
据此,请修改您请求正文中rgbColor
的属性如下。
发件人:
"rgbColor": {
"blue": 255,
"green": 0,
"red": 0
}
收件人:
"rgbColor": {
"blue": 1,
"green": 0,
"red": 0
}
参考:
如果我误解了你的问题,这不是你想要的结果,我深表歉意。