This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- GET back the object to verify that we saved it | |
response = {} | |
save = ltn12.sink.table(response) | |
id = objAsTable["_id"] -- get the _id field from the object table | |
url = "https://baas.kinvey.com/appdata/KINVEY_APP_ID/testObjects/" .. id | |
h = {Authorization = "Basic " .. (mime.b64("KINVEY_APP_ID:KINVEY_APP_SECRET")), ["Content-Type"] = "application/json" } | |
ok, code, headers = http.request{url = url, headers = h, sink = save, redirect = true, method = "GET"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- load required modules | |
http = require("socket.http") --luasocket | |
ltn12 = require("ltn12") | |
mime = require("mime") | |
io = require("io") | |
json = require("json") -- luajson | |
-- Create a Lua table to represent our entity to save | |
--- This is from our doc REST example: http://docs.kinvey.com/rest-appdata.html | |
jamesBond = { ["firstName"] = "James", ["lastName"] = "Bond", ["email"] = "[email protected]", ["age"] = 34 } |
NewerOlder