1
{ 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.

Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474

2 Answers2

0

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.

Prisoner
  • 49,922
  • 7
  • 53
  • 105
  • *which the node.js library handles as a separate object* - can you update my example to work with the module? What's the name of the object? – Ionică Bizău Mar 31 '14 at 16:24
0

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"
});
Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474