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

     

     

  • 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

      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

        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