我正在尝试从Google Sheet API获取请求,但我不知道如何在代码中传递API密钥。
local http = require("socket.http")
local body, code, headers, status = http.request("https://sheets.googleapis.com/v4/spreadsheets/1AQK1WHGsavVmhNugAipMsrweB3m25xp01vtzGA8BvwE/values/Global!A1:D5")
print(code, status, body)现在我收到了错误403
发布于 2019-12-31 17:52:11
将其作为查询参数添加到URL的末尾,如下所示:
http.request("https://sheets.googleapis.com/v4/spreadsheets/[spreadsheet-id]/values/Global!A1:D5?key=[YOUR_API_KEY]") 对于下一次,您可以在发出请求后,通过单击"Try this API“窗口上的展开图标来检查Sheets API 1是如何发出请求的。
[1] https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets.values/get
https://stackoverflow.com/questions/59538149
复制相似问题