API getting current logged in user data

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

API getting current logged in user data

Post by tadd » Mon Oct 29, 2018 3:41 am

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: 545
Joined: Thu Jul 27, 2006 11:58 am

Re: API getting current logged in user data

Post by mikeb » Mon Oct 29, 2018 8:29 am

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: 12
Joined: Wed Mar 21, 2018 7:24 am

Re: API getting current logged in user data

Post by tadd » Tue Oct 30, 2018 2:41 am

That has worked. Thank you

Post Reply