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" } } ] } }
如果您在创建数据集时省略了必需的正文参数(例如 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" } }
如需详细了解错误和错误处理,请参阅错误。