尝试使用 API 密钥访问 Google 表格时获取 PERMISSION_DENIED [英] Getting PERMISSION_DENIED when try to access Google Sheets with API Key
本文介绍了尝试使用 API 密钥访问 Google 表格时获取 PERMISSION_DENIED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我尝试使用这样的基本电子表格.values.get 请求从 Google 表格中获取数据
If I try to get data from Google Sheets with a basic spreadsheets.values.get request like this
https://sheets.googleapis.com/v4/spreadsheets/1p7sFt.....gRu9A/values/Sheet!1A1:L7?key=AIza.....oTXg it works.
但是,如果我向请求添加更多参数,它就会失败.例如:
But, if I add more parameters to the request it fails. Ex:
https://sheets.googleapis.com/v4/spreadsheets/1p7sFt.....gRu9A/values/Sheet1!A1:L7**?majorDimension=COLUMNS**?key=AIza.....oTXg
并返回:
{
"error": {
"code": 403,
"message": "The request cannot be identified with a client project. Please pass a valid API key with the request.",
"status": "PERMISSION_DENIED"
}
}
推荐答案
对多个查询字符串参数使用&符号&
,而不是多个?
Use ampersand &
for multiple query string parameters, not multiple ?
https://sheets.googleapis.com/v4/spreadsheets/1p7sFt.....gRu9A/values/Sheet1A1:L7**?majorDimension=COLUMNS**&key=AIza.....oTXg
这篇关于尝试使用 API 密钥访问 Google 表格时获取 PERMISSION_DENIED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文