- obj = {}
- obj.nome = “Erica Palmeira”
- local http = require(“socket.http”)
- local ltn12 = require(“ltn12”)
- local jsonData = json.encode(obj)
- local params = {}
- params.headers = {}
- params.headers[“application-id”] = “my app id”
- params.headers[“secret-key”] = “my secret key”
- params.headers[“Content-Type”] = “application/x-www-form-urlencoded” – x-www-form-urlencoded
- params.headers[“application-type”] = “REST”
- params.headers[“Content-Length”] = string.len(jsonData)
- URL = "https://api.backendless.com/v1/data/"…tabela
- response_body = {}
- local body, code, headers = http.request{
- url = URL ,
- method = “POST”,
- headers = params.headers,
- source = ltn12.source.string(jsonData),
- sink = ltn12.sink.table(response_body)
- }
- print("Body = ", body)
- print("code = ", code)
- print("headers = ", headers[1])
- print("response body = ", response_body[1])
Its showing this error: {“message”:“Entity can’t be empty”,“code”:8011}
Whats wrong? How to get it working?