Missing required field: member

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-05 06:38:26

问题


{ errors: 
   [ { domain: 'global',
       reason: 'required',
       message: 'Missing required field: member' } ],
  code: 400,
  message: 'Missing required field: member' }

I get this error when I run the following request:

var request = client.admin.members.insert({
    groupKey: "some_group@example.com"
  , email: "me@example.com"
});

I was authenticated successfully (I received the access token and so on) but when I execute the request above it callbacks that error.

What member field am I supposed to add?

It works fine in API Explorer using groupKey and email fields.


回答1:


The documentation at https://developers.google.com/admin-sdk/directory/v1/reference/members/insert for admin.members.insert indicates that it requires a groupKey parameter, but that the body (which the node.js library handles as a separate object) should contain a members object containing the role property. See the API Explorer a the bottom of that page as well.




回答2:


email is part of the form data. The form data must be passed as object in the second argument:

// create the group insert request
var request = client.admin.members.insert({
    groupKey: "some_group@example.com"
}, {
    email: "me@example.com"
});


来源:https://stackoverflow.com/questions/22765599/missing-required-field-member

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!