google-admin-sdk

How can I retrieve the CustomerId from a using Google API calls from a NonAdmin user?

[亡魂溺海] 提交于 2019-12-02 11:28:57
I'm trying to retrieve the 'customerId' value for a Non-Admin user on a Google Apps Enterprise. As a non-admin there are a lot of APIs I won't have access to. Is there any way for me to retrieve the 'customerId' for my account? The customerId is identical for all users in the Google Apps instance (including users in other secondary domains). If you're working with a single Google Apps instance, the customerId is static and thus once discovering it from an admin account, you can hard code it. In order to retrieve the customerId via the users.get() API call, the authenticated user needs to at

How to update a user's externalId using Java

核能气质少年 提交于 2019-12-02 10:06:36
I'm trying to update a user with an externalId based on the Google Admin SDK documentation. UserExternalId externalId = new UserExternalId(); externalId.setType( "account" ); externalId.setValue( "test" ); User user = new User(); user.setExternalIds( externalId ); try { User update = directory.users().update( "USERKEY", user ).execute().setExternalIds( externalId ); LOGGER.info("Response from google: " + update.toPrettyString()); User full = directory.users().get( "USERKEY" ).setProjection( "full" ).execute(); LOGGER.info( "Response from new get user: " + full.toPrettyString() ); } catch

Google Admin sdk directory 403

落爺英雄遲暮 提交于 2019-12-02 06:30:23
I'm trying to use googleapi 2.0 with service account to use Directory gooogle admin sdk on user on an entrprise domain. I've proceeded as suggested ( this for instance) and prepared a "wish to work" poc java code. Somthing like this... package com.mc3info.google.api20.test; import java.io.File; import java.security.NoSuchAlgorithmException; import java.security.UnrecoverableKeyException; import java.security.cert.CertificateException; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern;

How can I access user info on a domain without the domain administrator enabling API access?

穿精又带淫゛_ 提交于 2019-12-02 03:46:20
问题 I have written an application that I have listed in the Google Marketplace. I am trying to get my app to use the Directory API (part of the Admin SDK). According to the documentation here: https://developers.google.com/admin-sdk/directory/v1/guides/prerequisites, this will require anyone who installs my app to enable API access. The only scope I need is: https://www.googleapis.com/auth/admin.directory.user.readonly Is there any way to access the above scope without requiring API access to be

How can I access user info on a domain without the domain administrator enabling API access?

霸气de小男生 提交于 2019-12-02 01:01:50
I have written an application that I have listed in the Google Marketplace. I am trying to get my app to use the Directory API (part of the Admin SDK). According to the documentation here: https://developers.google.com/admin-sdk/directory/v1/guides/prerequisites , this will require anyone who installs my app to enable API access. The only scope I need is: https://www.googleapis.com/auth/admin.directory.user.readonly Is there any way to access the above scope without requiring API access to be enabled? All I am ultimately trying to do is import users from a domain into my app so that they do

How do I check if a user has 2-factor authentication enabled via Google Admin SDK APIs

会有一股神秘感。 提交于 2019-12-01 22:04:51
问题 I am using the Google Admin SDK APIs to manage users (create/update) in our organization's Google apps account. We allow users to optionally use the 2-factor authentication feature and I'd like to be able to determine if an account has it enabled or not when one of our internal support reps looks up their account. Looking over the docs at https://developers.google.com/admin-sdk/directory/v1/reference/users, I do not see any attributes that would indicate this setting. Is there another way for

Using Argparse with Google Admin API

我的未来我决定 提交于 2019-12-01 21:16:38
I am using Google's Python API to pull down auditing information, but I can't get the parent group arguments for argparse (which appear to be required for API access) and my own arguments (e.g. passing in a date) to work together. Code: import pprint import sys import re import httplib2 import json import collections import argparse from oauth2client import client from apiclient import sample_tools from apiclient import discovery from oauth2client.client import AccessTokenRefreshError from oauth2client.client import OAuth2WebServerFlow from oauth2client.file import Storage from oauth2client

How do I check if a user has 2-factor authentication enabled via Google Admin SDK APIs

烈酒焚心 提交于 2019-12-01 20:53:48
I am using the Google Admin SDK APIs to manage users (create/update) in our organization's Google apps account. We allow users to optionally use the 2-factor authentication feature and I'd like to be able to determine if an account has it enabled or not when one of our internal support reps looks up their account. Looking over the docs at https://developers.google.com/admin-sdk/directory/v1/reference/users , I do not see any attributes that would indicate this setting. Is there another way for me to check if it is enabled via an API? Emily Saw an answer from an old Stackoverflow post: Find all

Mobiledevices: action missing

徘徊边缘 提交于 2019-12-01 14:55:42
I am trying to perform a POST of the action, however, when I make the request I get code 400 speaking that the action value is missing. my code: function mobileAPIPOST() { var response = UrlFetchApp.fetch( "https://www.googleapis.com/admin/directory/v1/customer/my_customer/devices/mobile/fakexQ_fake0Z0dKFdSblfakeTnnfakel7IYwixfake4ddZfakeAIvnmu/action", { method: "POST", headers: { "Authorization": "Bearer " + ScriptApp.getOAuthToken(), "Content-Type": "application/json", }, data: { "action": "block" }, muteHttpExceptions: true }); } I updated the code following the response from @TheMaster.

Mobiledevices: action missing

南楼画角 提交于 2019-12-01 13:09:16
问题 I am trying to perform a POST of the action, however, when I make the request I get code 400 speaking that the action value is missing. my code: function mobileAPIPOST() { var response = UrlFetchApp.fetch( "https://www.googleapis.com/admin/directory/v1/customer/my_customer/devices/mobile/fakexQ_fake0Z0dKFdSblfakeTnnfakel7IYwixfake4ddZfakeAIvnmu/action", { method: "POST", headers: { "Authorization": "Bearer " + ScriptApp.getOAuthToken(), "Content-Type": "application/json", }, data: { "action":