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.

MikroTik API Lua library
#3
Unify API is done via HTTP requests. You need to send one request for login, get a cookie value from it and pass this cookie to any other requests after that.
Here's an example that can be used as a starting point: https://forum.logicmachine.net/showthrea...3#pid18233
The difference is that this example uses standard POST whereas Unify communicates via raw POST / JSON. Like this:
Code:
http = require('socket.http')
json = require('json')

login_url = 'https://IP:8443/api/login'
data = json.encode({
  username = user,
  password = pass,
})

res, err, hdrs = http.request(login_url, data)
log(res, err, hdrs)
Reply


Messages In This Thread
MikroTik API Lua library - by admin - 20.10.2020, 06:57
RE: MikroTik API Lua library - by FatMax - 20.10.2020, 11:48
RE: MikroTik API Lua library - by admin - 20.10.2020, 12:13
RE: MikroTik API Lua library - by DGrandes - 03.12.2020, 17:45
RE: MikroTik API Lua library - by admin - 04.12.2020, 07:35
RE: MikroTik API Lua library - by DGrandes - 07.12.2020, 13:11
RE: MikroTik API Lua library - by admin - 07.12.2020, 13:49
RE: MikroTik API Lua library - by DGrandes - 07.12.2020, 15:03
RE: MikroTik API Lua library - by admin - 09.12.2020, 07:19
RE: MikroTik API Lua library - by DGrandes - 09.12.2020, 08:09
RE: MikroTik API Lua library - by FatMax - 07.01.2021, 23:20
RE: MikroTik API Lua library - by Igori - 10.01.2021, 15:45
RE: MikroTik API Lua library - by admin - 11.01.2021, 08:07
RE: MikroTik API Lua library - by Igori - 11.01.2021, 19:50
RE: MikroTik API Lua library - by edgars - 26.08.2021, 08:28

Forum Jump: