處理要求錯誤

Maps Datasets API 會傳回錯誤訊息, 回應。舉例來說,如果您省略 OAuth 權杖的 要求或權杖已過期時,要求會傳回:

{
  "error": {
    "code": 401,
    "message": "Request is missing required authentication credential.
    Expected OAuth 2 access token, login cookie or other valid authentication credential.
    See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "status": "UNAUTHENTICATED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "CREDENTIALS_MISSING",
        "domain": "googleapis.com",
        "metadata": {
          "method": "google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1Alpha.ListDatasets",
          "service": "mapsplatformdatasets.googleapis.com"
        }
      }
    ]
  }
}

如果您在建立 Deployment 時省略必要的主體參數,例如 displayName 則該要求會傳回:

{
  "error": {
    "code": 400,
    "message": "display_name: Display name must be provided",
    "status": "INVALID_ARGUMENT"
  }
}

如果傳遞的資料集 ID 無效,要求會傳回:

{
  "error": {
    "code": 404,
    "message": "Dataset not found",
    "status": "NOT_FOUND"
  }
}

若要進一步瞭解錯誤和錯誤處理機制,請參閱 錯誤