Programmatically Add Domain Alias google apps api PHP

吃可爱长大的小学妹 提交于 2020-03-06 07:39:25

问题


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

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.

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.


回答1:


None such option exists in the current Admin SDK or the Reseller API.




回答2:


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"
}

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.



来源:https://stackoverflow.com/questions/25372841/programmatically-add-domain-alias-google-apps-api-php

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!