-
-
Save jjfajardo/e320166f1a9ec82ece0d to your computer and use it in GitHub Desktop.
This file contains 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"} | |
print(code) -- success should be a 200 | |
print(table.concat(response)) | |
-- convert back to the JSON object | |
loadedTable = json.decode(response[1]) | |
for k,v in pairs(loadedTable) do print(k,v) end | |
delete this gist | |
Comments are parsed with GitHub Flavored Markdown |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment