I want to get URL's of services for particular project, how can I do this?
I need URL's like .appspot.com
I tried App Engine Admin api, but it can only provide names of the services.
How to make a service discovery for Google App Engine? How to get service URL?
784 views Asked by Lem AtThere are 3 answers
On
you can get url's of App Engine services's versions through API calls, in 3 steps:
1) authenticate and get an access-token to the App Engine Admin API:
gcloud auth application-default print-access-token
2) with the access token, list all services in App Engine, and get their version ID (in the nested field "allocations"), and service ID:
curl -H "Authorization: Bearer [MY_ACCESS_TOKEN]" https://appengine.googleapis.com/v1/apps/[MY_PROJECT_ID]/services
3) with the version ID and service ID, get the full data on the version:
curl -H "Authorization: Bearer [MY_ACCESS_TOKEN]" https://appengine.googleapis.com/v1/apps/[MY_PROJECT_ID]/services/[SERVICE_ID]/versions/[VERSION_ID]/?view=FULL
The field versionUrl delivers the app URL for this specific version, in the following form:
default service:
other services:
https://[SERVICE_ID]-dot-[VERSION_ID]-dot-[PROJECT_ID].appspot.com
From there, you can build your own service discovery.
On
If you're manually constructing urls to services within the same project, you may find it easier to setup some dispatch rules.
https://cloud.google.com/appengine/docs/standard/python3/reference/dispatch-yaml
The dispatch.yaml allows you to override routing rules. You can use the dispatch.yaml to send incoming requests to a specific service (formerly known as modules) based on the path or hostname in the URL.
Depending on your needs, you can construct your url off of app_identity.get_default_version_hostname() without worrying about the underlying service, since the dispatch rules will route to the service by the url path.
The URL of a service other than default follows this pattern:
So for example if your service's name is
helloworldand your project ID ismyprojectidthen the URL would behelloworld-dot-myprojectid.appspot.com