尝试使用API​​密钥访问Google表格时获取PERMISSION_DENIED

时间:2016-09-27 11:29:52

标签: api-key google-sheets-api

如果我尝试使用基本的spreadsheets.values.get请求从Google表格中获取数据

https://sheets.googleapis.com/v4/spreadsheets/1p7sFt.....gRu9A/values/Sheet!1A1:L7?key=AIza.....oTXg it works.

但是,如果我在请求中添加更多参数,则会失败。 例如:

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"
  }
}

1 个答案:

答案 0 :(得分:1)

对多个查询字符串参数使用&符号&,而不是多个?

https://sheets.googleapis.com/v4/spreadsheets/1p7sFt.....gRu9A/values/Sheet1A1:L7**?majorDimension=COLUMNS**&key=AIza.....oTXg