Forum Discussion

briancostea's avatar
briancostea
Contributor
14 years ago

Is there a REST call to retrive the current user?

Hi,

 

I am new to Lithium so please be kind.  I just looked through the javascript examples in the restapidocs_11.9 zip file that I downloaded.  Am I missing something, or is there a REST call to retrive the current user?

 

Thanks

Brian

4 Replies

  • KaelaC's avatar
    KaelaC
    Lithium Alumni (Retired)
    14 years ago

    Welcome Brian! 

     

    There isn't a REST call to get the current user but there is a freemarker context object.  Check this out for a list of all the nice things you can know about the current user:

    http://lithosphere.lithium.com/t5/Developer-Knowledge-Base/Context-objects-for-custom-components-user/ta-p/9339

     

    You can use these variables to create your rest calls.  For example, if you wanted to get the current user's avatar you would make a call like this:

     

    /restapi/vc/users/id/${user.id}/profiles/avatar
  • AdamN's avatar
    AdamN
    Khoros Oracle
    14 years ago

    I don't think it's used often, but was able to find a /users/self method in the Community class which may be useful if you're making client-side calls externally. For example:

    http://lithosphere.lithium.com/restapi/vc/users/self

     

    If you're looking for the current user from within a custom component on the community, though, I'd definitely reccomend Kaela's suggestion.

     

  • KaelaC's avatar
    KaelaC
    Lithium Alumni (Retired)
    14 years ago

    Ooh, nice find.  I didn't even think of a user outside the app.