- HTTP request
- Path parameters
- Query parameters
- Request body
- Response body
- Authorization scopes
- Try it!
Lists information about the supported locations for this service. This method can be called in two ways:
- List all public locations: Use the path
GET /v1/locations. - List project-visible locations: Use the path
GET /v1/projects/{projectId}/locations. This may include public locations as well as private or other locations specifically visible to the project.
HTTP request
- List public locations:
GET https://cloud.googleapis.com/v1/locations - List locations for a specific project:
GET https://cloud.googleapis.com/v1/{name=projects/*}/locations
The URL uses gRPC Transcoding syntax.
Path parameters
| Parameters | |
|---|---|
name |
The resource that owns the locations collection, if applicable. |
Query parameters
| Parameters | |
|---|---|
filter |
A filter to narrow down results to a preferred subset. The filtering language accepts strings like |
pageSize |
The maximum number of results to return. If not set, the service selects a default. |
pageToken |
A page token received from the |
extraLocationTypes[] |
Optional. A list of special location types to include in addition to the generic Cloud locations. By default, omitting this field means only the generic Cloud locations will be returned in the response. The supported values are: "CLOUD_AI_ZONE" |
Request body
The request body must be empty.
Response body
If successful, the response body contains an instance of ListLocationsResponse.
Authorization Scopes
- Calling
GET /v1/locations (without a project path)supports using either an API Key or an OAuth token. - Calling
GET /v1/projects/{project_id}/locationsrequires an OAuth token with thecloud.locations.listIAM permission on the specified project.
For more information, see the Authentication Overview.
Examples
List all public standard locations (using your API Key):
curl -H "X-Goog-Api-Key: YOUR_API_KEY" \
"https://cloud.googleapis.com/v1/locations"
List all standard locations and AI zones (using OAuth):
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "X-Goog-User-Project: YOUR_PROJECT_ID" \
"https://cloud.googleapis.com/v1/locations?extra_location_types=CLOUD_AI_ZONE"
List standard locations and AI zones for a specific project (using OAuth):
curl -H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "X-Goog-User-Project: YOUR_PROJECT_ID" \
"https://cloud.googleapis.com/v1/projects/YOUR_PROJECT_ID/locations?extra_location_types=CLOUD_AI_ZONE"