Google APIを使用して会社ドメインのすべてのユーザーIDを取得するにはどうすればよいですか?ドメイン内のすべてのユーザーIDを取得する
私たちのドメインの下にあるすべてのユーザーのリストを取得したいと思います。
次に、各ユーザーのすべての電子メールのリストを取得したいと思います。
Google APIを使用して会社ドメインのすべてのユーザーIDを取得するにはどうすればよいですか?ドメイン内のすべてのユーザーIDを取得する
私たちのドメインの下にあるすべてのユーザーのリストを取得したいと思います。
次に、各ユーザーのすべての電子メールのリストを取得したいと思います。
私はあなたがRetrieve all users in a domainに言及していると思う:
、同じドメイン内のすべてのユーザーを取得し、次の
GET
要求を使用してAuthorize requestsで説明承認を含めるには。GET https://www.googleapis.com/admin/directory/v1/users?domain=example.com&maxResults=2
正常な応答を返す:
デフォルトで
GET https://www.googleapis.com/admin/directory/v1/users
?domain=primary domain name&pageToken=token for next results page
&maxResults=max number of results per page
&orderBy=email, givenName, or familyName
&sortOrder=ascending or descending
&query=email, givenName, or familyName:the query's value*
は、システムがユーザの電子メールアドレスのアルファベット順に100人のユーザーのリストを返します:読みやすくするために、この例では、改行を使用していますHTTP 200 status code。ステータスコードと一緒に、応答がexample.comドメイン(maxResults=2
)での2つのユーザーアカウントを返します。
{
"kind": "directory#users",
"users": [
{
"kind": "directory#user",
"id": "the unique user id",
"primaryEmail": "[email protected]",
"name": {
"givenName": "Liz",
"familyName": "Smith",
"fullName": "Liz Smith"
},
"isAdmin": true,
"isDelegatedAdmin": false,
"lastLoginTime": "2013-02-05T10:30:03.325Z",
"creationTime": "2010-04-05T17:30:04.325Z",
"agreedToTerms": true,
"hashFunction: "SHA-1",
"suspended": false,
"changePasswordAtNextLogin": false,
"ipWhitelisted": false,
"ims": [
{
"type": "work",
"protocol": "gtalk",
"im": "[email protected]",
"primary": true
}
],
"emails": [
{
"address": "[email protected]",
"type": "work",
"customType": "",
"primary": true
}
],
"addresses": [
{
"type": "work",
"customType": "",
"streetAddress": "1600 Amphitheatre Parkway",
"locality": "Mountain View",
"region": "CA",
"postalCode": "94043"
}
],
"externalIds": [
{
"value": "employee number",
"type": "custom",
"customType": "office"
}
],
"relations": [
{
"value": "susan",
"type": "friend",
"customType": ""
}
],
"organizations": [
{
"name": "Google Inc.",
"title": "SWE",
"primary": true,
"customType": "",
"description": "Software engineer"
}
],
"phones": [
{
"value": "+1 nnn nnn nnnn",
"type": "work"
}
],
"aliases": [
"[email protected]",
"[email protected]"
],
"nonEditableAliases: [
"[email protected]"
],
"customerId": "C03az79cb",
"orgUnitPath": "corp/engineering",
"isMailboxSetup": true,
"includeInGlobalAddressList": true
},
{
"kind": "directory#user",
"id": "user unique ID",
"primaryEmail": "[email protected]",
"name": {
"givenName": "admin",
"familyName": "two",
"fullName": "admin two"
},
"isAdmin": true,
"isDelegatedAdmin": true,
"lastLoginTime": "2013-02-05T10:30:03.325Z",
"creationTime": "2010-04-05T17:30:04.325Z",
"agreedToTerms": true,
"hashFunction: "SHA-1",
"suspended": true,
"suspensionReason": "ADMIN",
"changePasswordAtNextLogin": false,
"ipWhitelisted": false,
"emails": [
{
"address": "[email protected]",
"type": "work",
"customType": "",
"primary": true
}
],
"externalIds": [
{
"value": "contractor license number",
"type": "custom",
"customType": "work"
}
],
"relations": [
{
"value": "liz",
"type": "friend",
"customType": ""
}
],
"aliases": [
"[email protected]"
],
"nonEditableAliases: [
"[email protected]"
],
"customerId": "C03az79cb",
"orgUnitPath": "corp/engineering",
"isMailboxSetup": true,
"includeInGlobalAddressList": true
}
],
"nextPageToken": "next page token"
}
をまた、アカウント内のすべてのユーザーを取得するにはRetrieve all account users
をチェックアウトすることができます複数のドメインで構成されている場合は、
GET
リクエストを使用し、Authorize requestsに記載されている権限を含めます。