Soluciona problemas de Cloud Location Finder

En esta página, se muestra cómo resolver problemas con Cloud Location Finder.

La API devuelve un error 403

El siguiente problema ocurre cuando sucede lo siguiente:

Cloud Location Finder no está habilitado en tu proyecto

{
  "error": {
    "code": 403,
    "message": "Cloud Location Finder API has not been used in project PROJECT_ID before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudlocationfinder.googleapis.com/overview?project=PROJECT_ID then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "SERVICE_DISABLED",
        "domain": "googleapis.com",
        "metadata": {
          "activationUrl": "https://console.developers.google.com/apis/api/cloudlocationfinder.googleapis.com/overview?project=PROJECT_ID",
          "serviceTitle": "Cloud Location Finder API",
          "service": "cloudlocationfinder.googleapis.com",
          "containerInfo": "PROJECT_ID",
          "consumer": "projects/PROJECT_ID"
        }
      },
      {
        "@type": "type.googleapis.com/google.rpc.LocalizedMessage",
        "locale": "en-US",
        "message": "Cloud Location Finder API has not been used in project PROJECT_ID before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/cloudlocationfinder.googleapis.com/overview?project=PROJECT_ID then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry."
      },
      {
        "@type": "type.googleapis.com/google.rpc.Help",
        "links": [
          {
            "description": "Google developers console API activation",
            "url": "https://console.developers.google.com/apis/api/cloudlocationfinder.googleapis.com/overview?project=PROJECT_ID"
          }
        ]
      }
    ]
  }
}

Para resolver este problema, habilita la API de Cloud Location Finder en tu proyecto. Para obtener instrucciones, consulta la guía de inicio rápido.

No tienes permiso para un recurso

{
  "error": {
    "code": 403,
    "message": "Permission 'cloudlocationfinder.cloudLocations.list' denied on resource '//cloudlocationfinder.googleapis.com/projects/PROJECT_ID/locations/global' (or it may not exist).",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "IAM_PERMISSION_DENIED",
        "domain": "cloudlocationfinder.googleapis.com",
        "metadata": {
          "resource": "projects/PROJECT_ID/locations/global",
          "permission": "cloudlocationfinder.cloudLocations.list"
        }
      }
    ]
  }
}

Para resolver este problema, agrega el rol cloudlocationfinder.viewer a los proyectos con recursos a los que deseas hacer referencia en una consulta. Para obtener instrucciones, consulta la guía de inicio rápido.

La API devuelve un error 400

El siguiente problema ocurre cuando una consulta no es válida:

$ curl -H "Authorization: Bearer $(gcloud auth print-access-token)" 'https://cloudlocationfinder.googleapis.com/v1/projects/PROJECT_ID/locations/global/cloudLocations?filter=cloud_location_type=FAKE_LOCATION'
{
  "error": {
    "code": 400,
    "message": "Bad usage: Invalid enum name \"FAKE_LOCATION\" for type `cloud.reliability.cloudlocationfinder.storage.CloudLocation.CloudLocationType`.",
    "status": "INVALID_ARGUMENT",
    "details": [
...
}

Para resolver este problema, revisa el mensaje de error. Para obtener orientación sobre la sintaxis de las consultas y la sintaxis aceptable, consulta la referencia de la API de REST.