Forum Discussion
RogersRoland You can use this API to fetch email address of the required USER
<#assign emailAdd = rest ("users/id/"+user_id+"/email")> this will return you email address of respected USER.
Ex. http://community.lithium.com/community-name/restapi/vc/users/id/43/email
- RogersRoland9 years agoExpert
TariqHussain, I've attempted to use your code but it results in an error.
keshavkelkar, When i use yours, it doesn't give me an error but in turn also doesn't show anything.
I feel like i'm missing something.
- VarunGrazitti9 years agoBoss
keshavkelkar - The reason TariqHussain code is showing error is because:
isAdmin is not defined
apiVersion is not defined, should be 2.0
So, the working code would require you to define these variable before using. Once done, it'd work fine.
Try this for e.g.
<li>
<#assign qry = "select email from users where id = '${user.id}'" />
<#assign email = rest("2.0", "/search?q=" + qry?url + "&restapi.response_style=view").data.items[0].email />
<span class="label">Email:</span> <span class="value">${email}</span>
</li>I hope this helps.
- keshavkelkar9 years agoAce
RogersRoland Have you used respected user_id ????
<#assign emailAdd = rest ("users/id/"+user_id+"/email")>
for example
<#assign emailAdd = rest ("users/id/12345/email")>