{"id":27786299,"url":"https://github.com/clever/node-google-admin-sdk","last_synced_at":"2025-08-03T15:32:43.572Z","repository":{"id":26928455,"uuid":"30390703","full_name":"Clever/node-google-admin-sdk","owner":"Clever","description":"node.js library for Google's Admin SDK","archived":false,"fork":false,"pushed_at":"2024-09-23T15:44:43.000Z","size":81,"stargazers_count":13,"open_issues_count":1,"forks_count":2,"subscribers_count":64,"default_branch":"master","last_synced_at":"2025-06-21T23:01:51.238Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CoffeeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Clever.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2015-02-06T02:28:56.000Z","updated_at":"2025-02-21T09:33:41.000Z","dependencies_parsed_at":"2025-04-30T16:00:50.999Z","dependency_job_id":"9e2589ac-bb5e-449c-988a-a86dcff6efdd","html_url":"https://github.com/Clever/node-google-admin-sdk","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Clever/node-google-admin-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fnode-google-admin-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fnode-google-admin-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fnode-google-admin-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fnode-google-admin-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Clever","download_url":"https://codeload.github.com/Clever/node-google-admin-sdk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Clever%2Fnode-google-admin-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261206085,"owners_count":23124833,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-04-30T15:59:15.420Z","updated_at":"2025-06-21T23:02:23.090Z","avatar_url":"https://github.com/Clever.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# google-admin-sdk\nnode.js library that wraps Google's Admin SDK. A subset of CRUD actions in the [Directory API](https://developers.google.com/admin-sdk/directory/v1/reference/) are supported.\n\n[![Build Status](https://circleci.com/gh/Clever/node-google-admin-sdk/tree/master.png?style=shield)](https://circleci.com/gh/Clever/node-google-admin-sdk)\n\n## Initializing the library\nThe library includes 4 submodules:\n* [`OrgUnitProvisioning`](#OrgUnitProvisioning) for CRUD operations on [OrgUnits](https://support.google.com/a/answer/4352075?hl=en)\n* [`UserProvisioning`](#UserProvisioning) for CRUD operations on Google Apps users\n* [`GroupProvisioning`](#GroupProvisioning) for CRUD operations on Groups\n* [`Batch`](#Batch) for [batching requests](https://developers.google.com/+/domains/batch)\n\nTo use the library, you must have your Google credentials in the form\n```\nopts = {\n  client: {\n    id: '12345.apps.googleusercontent.com',\n    secret: 'abcdefgh'\n  },\n  token: {\n    refresh: 'your_refresh_token'\n  }\n};\n\n```\n\nThe library is designed such that you can initialize and use any submodule independently of the other three. Any or all submodules can be initialized using the credentials above:\n```\nadmin_sdk = require('google-admin-sdk');\nuser_provisioning = new admin_sdk.UserProvisioning(opts);\n```\n\n## Example usage\n```\nnew_user = {\n  name: {\n    givenName: 'Grace',\n    familyName: 'Hopper',\n  },\n  password: 'password1234',\n  primaryEmail: 'grace.hopper@example.com'\n  fields: \"kind,nextPageToken,users(id,kind,name,orgUnitPath,primaryEmail)\"\n};\nuser_provisioning.insert(new_user, function(err, body) {\n  console.log(\"Received response: \" + body);\n});\n```\nNote: it is recommended to use Google's [fields editor](https://developers.google.com/admin-sdk/directory/v1/reference/users/insert) to construct queries with `fields` arguments.\n\n```\nnew_user = {\n  name: {\n    givenName: 'Grace',\n    familyName: 'Hopper',\n  },\n  password: 'password1234',\n  primaryEmail: 'grace.hopper@example.com'\n};\nquery = user_provisioning.insert(new_usery);\nquery.exec(function(err, body){\n  // Handle error and body\n});\n```\n\u003ca name=\"OrgUnitProvisioning\" /\u003e\n## OrgUnitProvisioning\nThe following provide functionality for querying the orgunits endpoint of the Directory API. For information on constructing queries and parsing responses, see the [official documentation](https://developers.google.com/admin-sdk/directory/v1/reference/orgunits).\n### OrgUnitProvisioning.findOrCreate(customer_id, org_unit[, cache, callback])\nCreates an OrgUnit and any of its parents that need to be created. Accepts arguments:\n* `customer_id`: your Google customer id.\n* `org_unit`: an array of the form that specifies the path of the OrgUnit to create. For example, to create the OrgUnit \"/Users/Admins/SuperAdmins\", pass in `['Users', 'Admins', 'SuperAdmins'].\n* `cache` (optional): a map of strings representing OrgUnits that are known to exist. For example, `{'/': 1, 'Users':1, 'Admins':1}\n* `callback` (optional): function of the form `callback(error, body)` to call when the response is received.\n\nNote that `findOrCreate` uses [`async.memoize`](https://github.com/caolan/async#memoize). This can cause problems with tests that expect a fresh state at the beginning of each test. You can use [`async.unmemoize`](https://github.com/caolan/async#unmemoizefn) to reset state.\n\n### OrgUnitProvisioning.insert(customer_id, properties[, fields, callback])\nCreates an OrgUnit. Accepts arguments:\n* `customer_id`: your Google customer id.\n* `properties`: an object that specifies the name of the OrgUnit to create. Uses the form `{ name: 'X', parent: 'Y' }`. Note that the parent must already exist; to deep create an OrgUnit, use `OrgUnitProvisioning.findOrCreate`.\n* `fields` (optional): fields to return in the response.\n* `callback` (optional): function of the form `callback(error, body)` to call when the response is received.\n\n### OrgUnitProvisioning.list(customer_id, params, [, callback])\nLists OrgUnits owned by a customer. Accepts arguments:\n* `customer_id`: your Google customer id.\n* `params` (optional): object containing querystring arguments.\n* `callback` (optional): function of the form `callback(error, body)` to call when the response is received.\n\n### OrgUnitProvisioning.get(customer_id, org_unit_path, [, callback])\nGets a single OrgUnit owned by a customer. Accepts arguments:\n* `customer_id`: your Google customer id.\n* `org_unit_path`: String representation of the OrgUnit to find.\n* `callback` (optional): function of the form `callback(error, body)` to call when the response is received.\n\n### OrgUnitProvisioning.patch(customer_id, org_unit_path[, body, fields, callback])\nUpdates an OrgUnit using [patch semantics](https://developers.google.com/admin-sdk/directory/v1/guides/performance#patch). Accepts arguments:\n* `customer_id`: your Google customer id.\n* `org_unit_path`: the full OrgUnit path to update.\n* `body` (optional): object containing the fields to update on the OrgUnit and their new values.\n* `fields` (optional): fields to return in the response.\n* `callback` (optional): function of the form `callback(error, body)` to call when the response is received.\n\n### OrgUnitProvisioning.delete(customer_id, org_unit_path, [, callback])\nDeletes an OrgUnit. Accepts arguments:\n* `customer_id`: your Google customer id.\n* `org_unit_path`: String representation of the OrgUnit to delete.\n* `callback` (optional): function of the form `callback(error, body)` to call when the response is received.\n\n\n\u003ca name=\"UserProvisioning\" /\u003e\n## User Provisioning\nThe following provide functionality for querying the Users endpoint of the Directory API. For information on constructing queries and parsing responses, see the [official documentation](https://developers.google.com/admin-sdk/directory/v1/reference/users).\n### UserProvisioning.insert(body[, fields, callback])\nCreates a Google Apps user. Accepts arguments:\n* `body`: specifies the `name`, `password`, and `primaryEmail` of the user.\n* `fields` (optional): specifies which user fields are included in the response.\n* `callback` (optional): a function of the form `callback(error, body)` to be called when the response is received.\n\n### UserProvisioning.get(userkey[, callback])\nGets information for a single user. Accepts arguments:\n* `userkey`: the unique userkey of the user to find.\n* `callback` (optional): function of the form `callback(error, body)` to call when the response is received.\n\n### UserProvisioning.list(params[, callback])\nLists Google Apps users. Accepts arguments:\n* `params`: user fields to query by\n* `callback` (optional): function of the form `callback(error, body)` to call when the response is received.\n\n#### Example\n```\n// Get at most 200 users in the domain `example.com`\nparams = {\n  domain: 'example.com',\n  max_results: 200\n};\n\nuser_provisioning.list(params, function(err, body) {\n  // Handle error and do something with users\n});\n```\n\n### UserProvisioning.patch(userkey, body[, fields, callback])\nUpdates a user using [patch semantics](https://developers.google.com/admin-sdk/directory/v1/guides/performance#patch). Accepts arguments:\n* `userkey`: the unique userkey of the user to update.\n* `body`: object containing fields to update on the user and their new values.\n* `fields` (optional): fields to return in the response.\n* `callback` (optional): function of the form `callback(error, body)` to call when the response is received.\n\n### UserProvisioning.update(userkey, body[, fields, callback])\nSame as `patch`, but updates a user without using [patch semantics](https://developers.google.com/admin-sdk/directory/v1/guides/performance#patch).\n\n### UserProvisioning.delete(userkey[, callback])\nDeletes a user. Accepts arguments:\n* `userkey`: the unique userkey of the user to delete.\n* `callback` (optional): function of the form `callback(error, body)` to call when the response is received.\n\n\u003ca name=\"GroupProvisioning\" /\u003e\n## Group Provisioning\nGroupProvisioning supports all functions supported by UserProvisioning except `update`. The function signatures and behaviors are identical, except they accept a unique groupkey instead of a unique userkey.\n\n\u003ca name=\"Batch\" /\u003e\n## Batch\n### Batch.go(queries, callback)\nExecutes queries in batches. Accepts arguments:\n* `queries`: an array of GoogleQueries (returned by invoking CRUD functions in other submodules without a callback) to execute.\n* `callback`: function of the form `callback(error, body)` to call when the response is received.\n\n#### Example\n```\n  queries = [];\n  user1_properties = {\n    name: { familyName: 'Parr', givenName: 'Bob' },\n    password: 'password12345',\n    primaryEmail: 'bob@example.com'\n  };\n  user2_properties = {\n    name: { familyName: 'Huph', givenName: 'Gilbert' },\n    password: 'password12345',\n    primaryEmail: 'gilbert@example.com'\n  };\n  queries.push(UserProvisioning.insert(user1_properties));\n  queries.push(UserProvisioning.insert(user2_properties));\n  Batch.go(queries, function(error, results){\n    // Handle error and parse results\n  });\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclever%2Fnode-google-admin-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclever%2Fnode-google-admin-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclever%2Fnode-google-admin-sdk/lists"}