Hello there.
I have a few equipments that I wanna collect some data through API calling. But there's a catch.
The process to collect is that:
1. call a endpoint for login (http://host/login.fcgi) and parse username and password on Body formatted as JSON
The response of this call is a session token, that i have to use on all others call.
2. call the objetc endpoint with the session token as a Query Parameter (http://host/load_objetcs.fcgi?session="API_TOKEN". The object that i want is parsed in Body as JSON
Till there, no problem at all, i can setup a macro (ie.: {$API_TOKEN}) and use that on all others calls. But this session has a fixed "log out" time. Every 30 minutes i've to redo the login and retrieve another Token.
I was woundering if i can set up the macro with an item value, this way i can call the login endpoint every 15m and use it's value to set a macro. Then set up others itens that will use this macro as a Query Parameter.
The Endpoints that i have are:
Login: host/login.fcgi
Load Objects: host/load_objects.fcgi?session="API_TOKEN"
and others but with the same logic
Any ideas on how I can acomplish that?
Thanks!
I have a few equipments that I wanna collect some data through API calling. But there's a catch.
The process to collect is that:
1. call a endpoint for login (http://host/login.fcgi) and parse username and password on Body formatted as JSON
Code:
{
"login": "username,
"password": "password"
}
Code:
{
"session":"API_TOKEN"
}
Till there, no problem at all, i can setup a macro (ie.: {$API_TOKEN}) and use that on all others calls. But this session has a fixed "log out" time. Every 30 minutes i've to redo the login and retrieve another Token.
I was woundering if i can set up the macro with an item value, this way i can call the login endpoint every 15m and use it's value to set a macro. Then set up others itens that will use this macro as a Query Parameter.
The Endpoints that i have are:
Login: host/login.fcgi
Load Objects: host/load_objects.fcgi?session="API_TOKEN"
and others but with the same logic
Any ideas on how I can acomplish that?
Thanks!

Comment