I would like to build a quick and dirty flow to get active DHCP leases
Can someone help me get started with authentication?
From the API doc: Each request your application sends must include an authentication token in the JSON object. To get a token, your application must send an administrative username and password via HTTP POST method to your server. If the authentication succeeds, the server responds with a JSON object containing an authentication token.
So do I need to set up an HTTP Auth node?
Or should I just use an HTTP request node, and what type of authentication should I use (basic / digest / bearer)?
If someone could point me in the right direction that would be most appreciated - I can definitely do all the work to implement this myself just need a little help to get started.
Start by doing an initial http-request for the login
We use a Function node to prepare the headers and body of the POST request and if its succesful with a token we proceed with another request for the actual data.
Thanks. That works, I get a message object back with lots of data including msg.statusCode: 200, which sounds like it succeeded.
Do I need to feed the cookie received back into a new request? Or can I just make a new request? I'm guessing I do the same, but change the URL to https://10.11.12.223/admin/JSON-RPC. How do I achieve sending the raw body data as per:
yes .. you chain on another http-request and according to the manual this is to actually get the nonce token.
so its 2 requests to get the token and then a 3rd one for the actual data
hmm .. maybe the curly brackets are not needed and they are just there in the example to denote that
that part needs to be replaced with the configManagerID?
Okay you are an excellent teacher (I'm guessing from your style of response that you are an actual teacher? If not you really should be!)
That worked a treat.
So, a couple more questions... if you don't mind?
Back to the id. The doc says "this value should increment by one for each new request". I have not done this, but it seems to work perfectly fine. Should I be incrementing it for each of these multiple requests (i.e. session req, token req, configManagerID req, data req)?
Do I need to set up that session just once, forever? Or once for each request I make?
Is it the best way to just add a JSON node on the output of each HTTP request node, to convert the msg.payload into objects, so they can be used in each subsequent request?
Thanks so much for your very helpful and subtle helping!
hehe .. not at all .. my main job is video editing and part of a camera crew for weddings and christenings
im new to this stuff also .. learning along
the id .. good question .. i have no id-ea
sessions from what i know expire at some point .. depending on the server settings .. in this case your firewall device ? so avoid having anything hardcoded cause its going to change.
json node is not needed because if the reply is json the http-request nodes have the option to parse it into JS object if you choose that setting
Every time you make a request the server will respond with an id that should increment by 1, I think this is so you can check that no other request have been slipped in, on your session. So you do not have to increment, but you can use this as a security check if you wish.