JSON API method isLoggedin vs Login
Posted: Wed Jan 29, 2020 11:53 am
I am confirming that the user still has a valid session by the script below on a different page to the one i use to login.I am supplying an active session number to variable TIMETREX_SESSION_ID. I get a return echo that the user is logged in but no data. It looks like Timetrex API requires me to supply a username and password then use the Login Method before i query data. How do I get data without having to login every time i need to fetch data.
$TIMETREX_SESSION_ID = postToURL( buildURL( 'APIAuthentication', 'isLoggedin' ),$TIMETREX_SESSION_ID );
if ( $TIMETREX_SESSION_ID == FALSE ) {
echo "Login Failed!1<br>\n";
exit;
} else {
//echo "Session ID: $TIMETREX_SESSION_ID<br>\n";
echo "user is loggedin";
$user_data = postToURL( buildURL( 'APIUser', 'getUser' ), null);
print_r($user_data);
}