You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用gapi开发Google Fit REST API服务时,Discovery Document List API返回URL触发404错误的原因解析

Why the Google Fit Discovery Document URL from Discovery List API Returned 404

Great catch on figuring out the working URL—let’s break down why your initial attempt failed:

The Two Discovery Document URL Formats

Google offers two ways to fetch API discovery documents, but not all services support both anymore:

  • Service-specific endpoint (deprecated for many services): The URL you got from the Discovery List API (https://fitness.googleapis.com/$discovery/rest?version=v1) uses an older, service-specific pattern. This format was common in earlier Google API versions, but many services (including Google Fit) have since phased out support for these endpoints, leading to the 404 error you saw.
  • Centralized discovery endpoint (current recommended): The working URL you found (https://www.googleapis.com/discovery/v1/apis/fitness/v1/rest) uses Google's unified, centralized discovery service. This is the modern, supported way to retrieve discovery docs for all Google APIs—it’s more stable, consistently maintained, and the format you’ll find in most up-to-date official documentation.

Why the Discovery List API Returned the Outdated URL

It’s likely a case of metadata lag. The Discovery List API’s database might still retain records of the old service-specific endpoints even though the actual service servers no longer support them. Google sometimes deprecates old endpoints but takes time to update all related metadata sources.

Recommendation

Going forward, prioritize using the centralized discovery endpoint format. You can also directly copy the correct discovery document URL from the official documentation for the specific Google API you’re working with—this ensures you’re always using a valid, supported endpoint.

内容的提问来源于stack exchange,提问作者ogihara

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 17:19:07