Forum Discussion

perk's avatar
perk
Adept
10 years ago

What is restadmin?

We have these this line of code in our endpoints for zendesk integration:

 

<#assign username = restadmin("/settings/name/custom_zendesk.username").value />

 

What is restadmin? What does it contain?

  • OlivierS's avatar
    OlivierS
    Lithium Alumni (Retired)

    perk it's an object to make a REST call with Administrator permissions on behalf of the user viewing the component. This call essentially bypasses permission checks for the current user.

     

    From your code, it looks like you call the 'settings' API method to retrieve the value of the field 'custom_zendesk.username' and assign it to a variable called 'username':

     

    <#assign username = restadmin("/settings/name/custom_zendesk.username").value />

     

    More details on the restadmin context object here.

    • perk's avatar
      perk
      Adept
      Thanks! Is there a way to see all the possible values I can retrieve in
      this restadmin object?

      • KrisS's avatar
        KrisS
        Khoros Alumni (Retired)

        perk wrote:
        Thanks! Is there a way to see all the possible values I can retrieve in
        this restadmin object?


        It's just about anything, but a note of caution to be very careful when using restadmin. It's basically making calls as an administrator, so you can easily expose unwanted information to users if not careful. Wjhen you want to make the cal as a normal use, use "rest".