0

我正在尝试使用来自经销商帐户的 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。

我被困在这里。有什么我想念的..?

4

1 回答 1

0

是否为您的经销商域启用 API 访问?

http://support.google.com/a/bin/answer.py?hl=en&answer=60757

于 2013-06-28T22:46:50.123 回答