我正在尝试使用来自经销商帐户的 Google Provisioning API 创建帐户。假设经销商帐户是:reseller@reseller.com。在此之前,我已经从 Google Reseller API 订阅了域“domain.com”。
基于此链接(https://developers.google.com/google-apps/provisioning/#creating_a_user_for_a_domain)我创建这样的脚本:
package gapps;
import com.google.gdata.data.*;
import com.google.gdata.client.*;
import com.google.gdata.data.appsforyourdomain.AppsForYourDomainException;
import com.google.gdata.data.appsforyourdomain.generic.GenericEntry;
import com.google.gdata.util.*;
import java.net.*;
import java.io.*;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level`enter code here`;
import java.util.logging.Logger;
import sample.appsforyourdomain.labs.provisioning.ProvisioningApiMultiDomainSampleClient;
import sample.appsforyourdomain.labs.provisioning.ProvisioningApiMultiDomainSampleClient.UserProperty;
public class Gapps {
public static void main(String[] args) {
try {
Map<UserProperty, String> map = new HashMap<UserProperty, String>() ;
map.put(ProvisioningApiMultiDomainSampleClient.UserProperty.ADMIN ,"isAdmin");
GenericEntry genericEntry = new GenericEntry();
ProvisioningApiMultiDomainSampleClient provisioningApiMultiDomainSampleClient = new ProvisioningApiMultiDomainSampleClient("reseller@reseller.com", "*******", "domain.com", "sample-api");
genericEntry = provisioningApiMultiDomainSampleClient.createUser("user", "*******", "fname", "lname", map);
System.out.println(genericEntry.toString());
} catch (AppsForYourDomainException ex) {
Logger.getLogger(Gapps.class.getName()).log(Level.SEVERE, null, ex);
} catch (MalformedURLException ex) {
Logger.getLogger(Gapps.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(Gapps.class.getName()).log(Level.SEVERE, null, ex);
} catch (ServiceException ex) {
Logger.getLogger(Gapps.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
但是在尝试编译后它总是返回
您无权访问此 API。
我被困在这里。有什么我想念的..?