API getting current logged in user data

General support regarding TimeTrex, such as
configuring policies/taxes or processing payroll.
Post Reply
tadd
Posts: 16
Joined: Wed Mar 21, 2018 7:24 am

API getting current logged in user data

Post by tadd »

I am trying to get current logged in user data using API

I have tried the code below but its not returning anything
<code>
$current_user_object = postToURL( buildURL( 'APIUser', 'getCurrentUserObject' ) );
var_dump($current_user_object);
</code>

however if I try to get user data after specifying arguments the code below works fine
<code>
$user_data = postToURL( buildURL( 'APIUser', 'getUser' ), array( $arguments ) );
print_r($user_data);
</code>

Is there a way to get current logged in user name or ID given that the user is already logged in using API.
mikeb
Posts: 709
Joined: Thu Jul 27, 2006 11:58 am

Re: API getting current logged in user data

Post by mikeb »

Try this:

Code: Select all

postToURL( buildURL( 'APIAuthentication', 'getCurrentUser' ), NULL );
TimeTrex Community Edition is developed and supported by volunteers.
Help motivate us to continue by showing your appreciation!
tadd
Posts: 16
Joined: Wed Mar 21, 2018 7:24 am

Re: API getting current logged in user data

Post by tadd »

That has worked. Thank you
Post Reply