Google sheets 如何在LUA中使用api密钥发出GET请求
我试图从GoogleSheetAPI获得一个请求,但我不知道如何在代码中传递API密钥Google sheets 如何在LUA中使用api密钥发出GET请求,google-sheets,lua,google-sheets-api,Google Sheets,Lua,Google Sheets Api,我试图从GoogleSheetAPI获得一个请求,但我不知道如何在代码中传递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(c
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,将其添加到URL末尾作为查询参数,如下所示:
http.request("https://sheets.googleapis.com/v4/spreadsheets/[spreadsheet-id]/values/Global!A1:D5?key=[YOUR_API_KEY]")
下一次,您可以在“尝试此API”窗口中单击展开图标,然后从该窗口发出请求,从而检查Sheets API[1]是如何发出请求的
[1] 我认为您需要在名为key的字段中使用http Post和api密钥: