以编程方式添加Domain Alias Google Apps API PHP [英] Programmatically Add Domain Alias google apps api PHP
问题描述
我拥有Google Apps for Business的转销商帐户.我正在从GitHub存储库中使用适用于PHP的google-api-php-client SDK:
I have a reseller account with Google Apps For Business. I am using the google-api-php-client SDK for PHP from the GitHub repository:
https://github.com/google/google-api-php-client
我已经将客户帐户创建为转销商.我已经使用站点验证服务验证了主域.我正在尝试为客户帐户的主域添加域别名.我没有在API中看到有关此过程的任何文档.我知道如何使用管理面板执行此操作.我也知道如何为用户电子邮件添加别名,但是,我不需要用户别名,因为我将要迁移数百个电子邮件帐户,并且需要域别名.
I have already created the customer account as a reseller. I have verified the primary domain using the site verification service. I am trying to add a domain alias to the primary domain for the customers account. I am not seeing any documentation for this process in the API. I know how to do this using the admin panel. I also know how to add an alias for the users email, however, I do not want a user alias because I will be migrating hundreds of email accounts and need the domain alias.
有人知道如何使用上述API或使用自定义请求来完成此操作吗?
Does anyone know of how to accomplish this using the above API or use a custom request?
如果这个问题太含糊,请告诉我.
If this question is too vague please let me know.
推荐答案
Assuming there are no restrictions on a reseller account that would prevent it, you can manage DomainAliases including adding and alias through the Directory API using the following post request (replacing 'myalias.com' and 'parentdomain.com' with your values; you will need to include your authorization token Authorization header).
POST https://www.googleapis.com/admin/directory/v1/customer/my_customer/domainaliases
Authorization: Bearer xxx-token-xxx
Content-Type: application/json
{
"domainAliasName": "myalias.com",
"parentDomainName": "parentdomain.com"
}
该API方法的文档包括API Explorer提供了方便的表单来测试此API调用.完成此页面上的表单后,在客户"字段中输入"my_customer".
The documentation for this API method includes the APIs Explorer providing a convenient form for test this API call. When completing the form on this page, enter 'my_customer' in the customer field.
这篇关于以编程方式添加Domain Alias Google Apps API PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!