perk
10 years agoAdept
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?
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?
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 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".
perk wrote:
Thanks! How may I know what other variables exist in /settings/name/ ? Is there a list I can access somewhere?
You can use the user settings call to get a list of potential options. Please note the call from your example is a custom field, but those should show up in the list as well.
When i am making this request:
http://community.lithium.com/community-name/restapi/vc/users/id/[id]/settings
I am getting:
error 404: this page could not be found
If you believe you are seeing this message in error, please contact communityhelp@lithium.com
and note this message and page URL.
How should I access this page?
perk wrote:
When i am making this request:
http://community.lithium.com/community-name/restapi/vc/users/id/[id]/settings
I am getting:
error 404: this page could not be found
If you believe you are seeing this message in error, please contact communityhelp@lithium.com
and note this message and page URL.
How should I access this page?
It's just an example of the call structure. You need to substitute your community values for the domain and ID, then append the rest to it. E.g.: http://yourcommunity.com/restapi/vc/users/user_ID_goes_here/settings
I tried on my lithium instance and I received the following error:
This XML file does not appear to have any style information associated with it.
The document tree is shown below.
<response status="error"><error code="501"><message>
Unknown path element at node 'community.users'.
</message></error></response>
Any help will be appreciated.
Alright, I am able to retrieve http://[mycommunity]/restapi/vc/users/self/settings/name/custom_zendesk.username but how do I retrieve all the custom_zendesk values available?
Retrieving http://[mycommunity]/restapi/vc/users/self/settings/ doesn't show any custom_zendesk values. Neither does http://[mycommunity]/restapi/vc/users/self/settings/name