Reputation: 75
I have an app, through which Google G Suite customers can transfer their billing to my reseller console. Now if someone tries to transfer a domain which is already under my account, how can I identify that and return a corresponding message.
I am using PHP as my development language
Upvotes: 0
Views: 295
Reputation: 5287
I don't know if there is straight forward API call or not for this purpose but following endpoint can be used to get this information.
GET https://developers.google.com/admin-sdk/reseller/v1/reference/customers/domain
The response format if customer is already under reseller account
{
"kind": "reseller#customer",
"customerId": string,
"customerDomain": string,
"postalAddress": {
"kind": "customers#address",
"contactName": string,
"organizationName": string,
"locality": string,
"region": string,
"postalCode": string,
"countryCode": string,
"addressLine1": string,
"addressLine2": string,
"addressLine3": string
},
"phoneNumber": string,
"alternateEmail": string,
"resourceUiUrl": string,
"customerDomainVerified": boolean
}
Otherwise if domain exists but customer is not under reseller account,
{
"kind": "reseller#customer",
"customerId": string,
"customerDomain": string
}
If the domain itself doesn't have google apps account, an error status will be returned.
You can check on any of the difference in JSON response to find if user already exists under reseller account or not.
Upvotes: 0