清除 Google Admin SDK API 中的 DATE 字段
Clearing DATE field in Google Admin SDK API
这里有 Google 工作区 DEV 吗?
我有一些我的用户字段,我试图通过 API 清除。
使用
方法:users.update
https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/update
如果我以“”的形式传递空值,它会尝试清除某些字段的用户属性。它适用于布尔值和字符串(到目前为止我已经测试过)
但不适用于 DATE 字段。
这是我发送的 JSON
{
"customSchemas": {
"includeInGlobalAddressList": "true",
"OffBoarding": {
"abooleanvalue1": "",
"astringvalue1": "",
},
"General": {
"aDateValue": ""
}
}
}
returns
{
"error": {
"code": 400,
"message": "Invalid Input",
"errors": [
{
"message": "Invalid Input",
"domain": "global",
"reason": "invalid"
}
]
}
}
如果我使用相同的格式设置值,它会成功更新值
{
"customSchemas": {
"includeInGlobalAddressList": "true",
"OffBoarding": {
"abooleanvalue1": "",
"astringvalue1": "",
},
"General": {
"aDateValue": "2020-01-01"
}
}
}
会很好。
我尝试使用 GAM 对其进行测试。一样
gam 更新用户 test.user@comany.com OffBoarding.astringvalue1 ""
会工作,但如果我在日期字段上做同样的事情。
gam 更新用户 test.user@comany.com General.aDateValue “”
错误:400:无效输入 - 无效
到目前为止,我的 google 搜索没有找到任何相关信息,或者我需要更多咖啡。我能找到的最近的是这个线程
Unable to clear Google user property completely
但这归因于一个实际问题,我已经尝试发送
[]
[""]
无效的
正如他们在那里所建议的那样,到目前为止还没有运气。
重置 date
类型的用户 属性 的方法是将其设置为 null
:
{
"customSchemas": {
"includeInGlobalAddressList": "true",
"OffBoarding": {
"abooleanvalue1": "",
"astringvalue1": "",
},
"General": {
"aDateValue": null
}
}
}
这里有 Google 工作区 DEV 吗?
我有一些我的用户字段,我试图通过 API 清除。
使用
方法:users.update
https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/update
如果我以“”的形式传递空值,它会尝试清除某些字段的用户属性。它适用于布尔值和字符串(到目前为止我已经测试过) 但不适用于 DATE 字段。 这是我发送的 JSON
{
"customSchemas": {
"includeInGlobalAddressList": "true",
"OffBoarding": {
"abooleanvalue1": "",
"astringvalue1": "",
},
"General": {
"aDateValue": ""
}
}
}
returns
{
"error": {
"code": 400,
"message": "Invalid Input",
"errors": [
{
"message": "Invalid Input",
"domain": "global",
"reason": "invalid"
}
]
}
}
如果我使用相同的格式设置值,它会成功更新值
{
"customSchemas": {
"includeInGlobalAddressList": "true",
"OffBoarding": {
"abooleanvalue1": "",
"astringvalue1": "",
},
"General": {
"aDateValue": "2020-01-01"
}
}
}
会很好。
我尝试使用 GAM 对其进行测试。一样
gam 更新用户 test.user@comany.com OffBoarding.astringvalue1 ""
会工作,但如果我在日期字段上做同样的事情。
gam 更新用户 test.user@comany.com General.aDateValue “”
错误:400:无效输入 - 无效
到目前为止,我的 google 搜索没有找到任何相关信息,或者我需要更多咖啡。我能找到的最近的是这个线程 Unable to clear Google user property completely 但这归因于一个实际问题,我已经尝试发送
[] [""] 无效的 正如他们在那里所建议的那样,到目前为止还没有运气。
重置 date
类型的用户 属性 的方法是将其设置为 null
:
{
"customSchemas": {
"includeInGlobalAddressList": "true",
"OffBoarding": {
"abooleanvalue1": "",
"astringvalue1": "",
},
"General": {
"aDateValue": null
}
}
}