使用Firebase App Distribution API获取版本信息时遇无效参数错误
解决Firebase App Distribution API「Request contains an invalid argument」错误
核心问题:API路径格式错误
你当前请求的URL使用了apps路径段,但针对Android应用的Firebase App Distribution API接口,正确的路径应该使用androidApps。这是导致400无效参数错误的主要原因。
修正后的请求命令
将原curl命令中的apps替换为androidApps,执行以下命令:
curl -s -H "Authorization: Bearer $ACCESS_TOKEN" \ "https://firebaseappdistribution.googleapis.com/v1/projects/testo-ea214/androidApps/1:702746187202:android:408e8617b41fd4b098725b/releases"
额外排查点
- 确认应用存在发布版本:如果该应用从未通过Firebase App Distribution上传过任何版本,API会返回空列表而非错误,但需确保你确实有已发布的版本可查询。
- 验证权限范围:虽然你的令牌能调用其他API,可尝试用包含
https://www.googleapis.com/auth/firebase.appdistribution的范围重新生成令牌测试,命令如下:gcloud auth print-access-token --scopes=https://www.googleapis.com/auth/firebase,https://www.googleapis.com/auth/firebase.appdistribution - 检查API版本兼容性:v1版本是稳定版,v1beta1为测试版,两者路径规则一致,替换路径后均可正常使用。
内容的提问来源于stack exchange,提问作者Rania
相关产品推荐
相关产品推荐

