Is there any way to get the logged user information through API?

Answered

12 Comments

  • Eric Nelson
    Zendesk Developer Advocacy
    Hey Israr, 
     
    Are you looking for user info for the the requester who opened the ticket? If so, you can find this by sideloading the records. 
     
    Thanks!
    0
  • Israr Ansari

    Hey Eric Nelson
    No, I am not looking for it. basically, I want to get the information of  the login user or current user there is no API or method that fetches login user information 

    For Example 

    get_the_current_user() this method would return the id of the login user in WordPress through that we can fetch all the user information. So is there any way to do it in Zendesk?


    Thanks!

    0
  • Eric Nelson
    Zendesk Developer Advocacy
    Hey Israr,

    Can you tell me more about your use case?

    Thanks!
    0
  • Israr Ansari

    Hey Eric

    Basically, I want to show some settings or configurations of my custom app on the ticket side but this setting is only visible for the admin not for the agent. So I want to develop a condition if the login user is an agent do something and if the login user is an admin show setting to him/her. That's why I want to get login user information. but unfortunately, I did not find something in the documentation that guide me on this. I hope you get my point if you have any questions about this then let me know.

    Thanks!

    0
  • Eric Nelson
    Zendesk Developer Advocacy
    Hey Israr,

    Thanks for the additional info. You can use the currentUser method available for the Apps Framework to accomplish this. 
     
    zafClient.get('currentUser.role')
     
    Hope this helps! 


     
    0
  • Israr Ansari

    Hey Eric

    Thanks! this works for me

    0
  • Aleksandar Salevski

    i  get this error, ReferenceError: client is not defined

    0
  • Aleksandar Salevski

    Or i go this:

    0
  • Greg Katechis
    Zendesk Developer Advocacy
    Hi Aleksandar! It looks like you're trying to use the Zendesk Apps framework outside of the context of the Zendesk agent interface, which is the reason that you're running into this issue. You can read more about how to use ZAF here, but feel free to share what you're trying to do so that I can help point you in the right direction!
    0
  • Aleksandar Salevski

    0
  • Aleksandar Salevski

    Any help here Greg Katechis?

    0
  • Aleksandar Salevski

    Guys any  help on  this one!

    0

Please sign in to leave a comment.

Powered by Zendesk