This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Would IFTTT be possible to integrate?
#19
JSON post example:
Code:
function post(url, body)
  local ltn12 = require('ltn12')
  local https = require('ssl.https')
  local sink = {}

  local res, err = https.request({
    url = url,
    method = 'POST',
    headers = {
      ['Content-Length'] = #body,
      ['Content-Type'] = 'application/json',
    },
    sink = ltn12.sink.table(sink),
    source = ltn12.source.string(body),
  })

  if res then
    return table.concat(sink)
  else
    return nil, err
  end
end

require('json')

url = 'https://postman-echo.com/post'
body = json.encode({ value1 = '123' })
res, err = post(url, body)
Reply


Messages In This Thread
RE: Would IFTTT be possible to integrate? - by admin - 21.04.2020, 11:16

Forum Jump: