问题描述
这是我的代码:
以下是回复:
2020/09/14 12:19:51.425:INFO添加ppsEmailAddress作为恢复电子邮件的结果:{data = [对象对象],finalURL = https://www.googleapis.com/admin/directory/v1/users /[email protected],标头= {Alt-Svc = h3-29 =“:443”; ma = 2592000,h3-27 =“:443”; ma = 2592000,h3-T051 =“:443”; ma = 2592000,h3-T050 =“:443”; ma = 2592000,h3-Q050 =“:443”; ma = 2592000,h3-Q046 =“:443”; ma = 2592000,h3-Q043 =“:443”; ma = 2592000,quic =“:443”; ma = 2592000; v =“ 46,43”,Content-Length = 357,Content-Type = application / json; charset = UTF-8,Date = Mon,2020年9月14日19:19:51 GMT,Server = ESF,vary = [Origin,X-Origin,Referer],X-Content-Type-Options = nosniff,X-Frame-选项= SAMEORIGIN,X-XSS-Protection = 0},initialURL = https://www.googleapis.com/admin/directory/v1/users/[email protected],statusCode=400.0,statusReason=错误的请求} >
完整代码:
尝试在此处遵循Google Api参考,尽管我的语法有误: https://developers.google.com/admin-sdk/directory/v1/reference/users#resource
解决方法
这是我的请求的格式:
PATCH /admin/directory/v1/users/[email protected] HTTP/1.1
Host: www.googleapis.com
Content-length: 45
Content-type: application/json
Authorization: Bearer {REPLACE WITH ACCESS TOKEN}
{
recoveryEmail: "[email protected]"
}
确保callGoogleAPI()
以此格式发出请求。
参考: https://developers.google.com/admin-sdk/directory/v1/reference/users/patch