Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a domain alias to a secondary domain using the Google Apps Domains API

I'm using Google Apps and I'm trying to add a domain alias to a secondary domain I own.

According to this Google Apps blog article "the [domains] API lets you programmatically add aliases for any domain, primary or secondary, but aliases for secondary domain can only be added via the API."

I tried the API on the APIs explorer (at the bottom of the page) but only managed to add a domain alias to my primary domain and not to my secondary.

Using a POST method I've tried:

{
 "domainName": "alias.domain.com",
 "domainAliases": [
  {
   "parentDomainName": "secondary.domain.com",
   "verified": true
  }
 ]
}

Any light on the matter would be greatly appreciated.

Regards,

Jo

like image 925
jowze Avatar asked Jan 13 '16 15:01

jowze


People also ask

How do I add an alias to my Google domain?

Click the Accounts and Import or Accounts tab. In the "Send mail as" section, click Add another email address. Enter your name and your alias address. Check the Treat as an alias box.

Can you create an alias with different domain?

user alias domains allow users to send mail with an email address at another domain. For example, you might have 2 different products each with their own domain. Having a user alias domain for these domains will allow people to send mail using an address from either domain.

How do I add a domain to Google API?

If the APIs & services page isn't already open, open the console left side menu and select APIs & services. On the left, select Domain verification. Click Add domain. Enter the domain that you previously registered with Google Search Console.

What is a secondary domain?

A Second Level Domain (SLD) is the part of the domain name that is located right before a Top Level Domain (TLD). For example, in mozilla.org the SLD is mozilla and the TLD is org . A domain name is not limited to a TLD and an SLD.


1 Answers

You need to use the DomainAliases API:

https://developers.google.com/admin-sdk/directory/v1/reference/domainAliases/insert

From there enter:

customer = your immutable ID
domainAliasName = the alias to add
parentDomainName = the secondary domain to which you want to add an alias

That should be it.

like image 159
Ahmed Khalil Avatar answered Oct 17 '22 06:10

Ahmed Khalil