Page 1 of 1

API getting current logged in user data

Posted: Mon Oct 29, 2018 3:41 am
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.

Re: API getting current logged in user data

Posted: Mon Oct 29, 2018 8:29 am
by mikeb
Try this:

Code: Select all

postToURL( buildURL( 'APIAuthentication', 'getCurrentUser' ), NULL );

Re: API getting current logged in user data

Posted: Tue Oct 30, 2018 2:41 am
by tadd
That has worked. Thank you