Forum Discussion

jaikumar1's avatar
jaikumar1
Mentor
7 years ago

How to get username from the API?

Hi,

 

I'm just facing the issue in production, the username is not getting loaded in the API result set. But i'm getting the username in staging server.

 

As per my understanding, there may be an permission issue. Please guide me on how to resolve this issue.

 

 

  • jaikumar1- The login name is being returned empty, because either they are the anonymous users which don't have the username or those users haven't completed the registration yet. 

     

    You can try below query which will return only registered online users and they all should have the login name.

     

    http://<communityurl>/restapi/vc/users/online/registered

     

     

4 Replies

  • jaikumar1: Did  it is the point to any error message and what is the API Call you are using to get the result.

     

    Are you using Ajax API Call in the Production?

     

    If my post is helpful and answers your question, please give "Kudos" and "Accept it as a Solution."

    Thanks & Regards,
    Abhishek Illindra

  • jaikumar1's avatar
    jaikumar1
    Mentor
    7 years ago

    Thank you for your response AbhishekIlindra,

     

    I used the /users/online rest api call in the custom component. Based on the component result, i just customized the output. 

     

    From the rest api result set returning all other information like last_visit_time, id and etc. But it's not return the "login" and which contain the username, and it returns empty string. 

     

  • TariqHussain's avatar
    TariqHussain
    Boss
    7 years ago

    jaikumar1- The login name is being returned empty, because either they are the anonymous users which don't have the username or those users haven't completed the registration yet. 

     

    You can try below query which will return only registered online users and they all should have the login name.

     

    http://<communityurl>/restapi/vc/users/online/registered

     

     

  • jaikumar1's avatar
    jaikumar1
    Mentor
    7 years ago

    Thank you so much TariqHussain,

     

    I just understand the issue, and the query which you have suggested is working fine. Also i need to display the newest community member, i have used 

    http://<communityurl>/restapi/vc/users/registered

    But this query also returning the empty login name. So here could you suggest, any alternate query we can use, or any additional parameter we can use, or we need to write any additional condition to restrict the empty results? Please suggest.