If you take a look at the code: https: //github.com/google/google-api-nodejs-client/blob/master/apis/admin/directory_v1.js
you can see the directory-v1 -> users object and the insert() method. It takes a "params" argument. This params argument gets wrapped as a larger "parameters" argument and sent to the "createApiRequest" method, which is found here: https: //github.com/google/google-api-nodejs-client/blob/master/lib/apirequest.js In the createApiRequest, you can see that it pulls optional user supplied headers out of the parameters.params.headers object. To construct this, see below for some modifications to your code. var createUser = { auth: auth, headers: { 'Content-Type': 'application/json' }, customer: 'my_customer', "name": { "givenName": newUser.First, "familyName": newUser.Last }, "password": "mcs12345", "primaryEmail": newUser.District_Email, "changePasswordAtNextLogin": false, "orgUnitPath": "/Staff" }; var admin = google.admin( "directory_v1"); var id = admin.users.insert(createUser).id; // Authorize a client with the loaded credentials, then call the // Directory API. fs.writeFile("gid.txt", "mcs" + id); }); Hopefully this works for you. Chris On Thursday, May 5, 2016 at 7:43:31 PM UTC-6, Scott Croskey wrote: > > I saw that post, but did not know how to do that. > > On Thursday, May 5, 2016 at 12:04:34 AM UTC-4, Christopher Mina wrote: >> >> Hi. >> >> I'm not familiar with the library, but your code generally look ok. >> >> Check out this StackOverflow post, maybe it's as simple as setting the >> header ContentType to application/json? Would be an improper error message >> if so, but hey, stranger things have happened: >> >> http://stackoverflow.com/a/29824566/1359401 >> >> -Chris >> >> >>> > PLEASE NOTE: This message and any response to it may constitute a public > record, and therefore may be available upon request in accordance with Ohio > public records law. (ORC 149.43) -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. To post to this group, send email to nodejs@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/8cd8fd5d-7d84-48ce-92bb-db3424f03066%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.