Hello,

Please look into this document 
<https://cloud.google.com/appengine/docs/standard/python/appidentity/#getting_the_application_hostname>,
 
which describes using the app_identity.get_default_version_hostname() 
method you can retrieve the entire hostname component if an app is served 
from a custom domain where the app ID is part of the hostname (i.e. 
http://<your_app_id>.appspot.com). So as George mentioned earlier you are 
getting expected behavior from the 
app_identity.get_default_version_hostname() method.

Regarding your second question, if your domain is mapped to your App Engine 
app you can use the apps.domainMappings.list 
<https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta/apps.domainMappings/list>
 
method to list your resource records. You can also achieve this using 
Console or gcloud command "gcloud app domain-mappings list" 
<https://cloud.google.com/sdk/gcloud/reference/app/domain-mappings/list>. 
 You can get more details on this at number four point of this document 
<https://cloud.google.com/appengine/docs/standard/java/mapping-custom-domains#adding_a_custom_domain_for_your_application>
 
and on gcloud command “gcloud app domain-mappings” here 
<https://cloud.google.com/sdk/gcloud/reference/app/domain-mappings/>. If 
your domain is not mapped, to programmatically map your domain to your App 
Engine app you can use the app.domainMappings.create 
<https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta/apps.domainMappings/create>
 
method. You can find more about the methods available with REST Resource: 
apps.domainMappings here 
<https://cloud.google.com/appengine/docs/admin-api/reference/rest/v1beta/apps.domainMappings#methods>.
 



On Wednesday, January 16, 2019 at 7:21:00 PM UTC-5, NP wrote:
>
> Thanks for the response.
>
> With regards to question 2, if the project is being deployed by different 
> users (hence different domains), you wouldn't know the custom domain URL 
> upfront. A work around is to have user enter the value, which then gets 
> stored and then you read it. I just wanted to know if there was an API that 
> provided this value directly so that I wouldn't be reinventing the wheel.
>
>
> On Wednesday, January 16, 2019 at 1:44:38 PM UTC-8, George (Cloud Platform 
> Support) wrote:
>>
>> In reply to your first question, you are right: 
>> google.appengine.api.app_identity.app_identity.get_default_version_hostname()
>>  
>> gets the standard host name of the default version of the app. For example, 
>> if your application_id is my-app, then the result might be 
>> my-app.appspot.com. You may check this on the 
>> "google.appengine.api.app_identity.app_identity module" page 
>> <https://cloud.google.com/appengine/docs/standard/python/refdocs/google.appengine.api.app_identity.app_identity#top_of_page>
>> . 
>>
>> In what concerns question 2), there does not seem to be a compelling need 
>> to programmatically obtain the custom name instead, as the standard host 
>> name and the custom one point to the same site, and can be used 
>> interchangeably. Mapping between custom ID has been performed by project 
>> owners, and the information should be readily available, even if not by 
>> means of an API call from your code. In other words, you are supposed to 
>> know your custom domain URL already. 
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To post to this group, send email to google-appengine@googlegroups.com.
Visit this group at https://groups.google.com/group/google-appengine.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/d33d10db-1c0e-4399-8b6f-fa639c9a9cb6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to