Forum Discussion

Sunny's avatar
12 years ago
Solved

Can legacy rank of a user retrieved by REST API without logging into instance?

I have written a code for getting legacy rank of an user.

I get that rank image if I am logged into an instance,

but if I am not logged in then it shows me an error text on page that "This widget could not be displayed"

 

Does anyone know a solution on this?

  • Hi Sunny,

     

    I'm not sure exactly what you mean by legacy rank. Are you simply referring to the user's current rank in the community? If so, it could be the case that the annoymous user does not have permission to make the REST API call you're attempting.

     

    I assume you're using the "rest(...)" custom Freemarker context object? If it's an issue with permissions and you want to still expose this information to anonymous users, you could use the "restadmin(...)" to make the request as an administrator user instead. This will allow you to bypass the permission issues, but I do urge caution when using this context object since you are in effect making the call as an administrator.

     

    "restadmin" should be used very sparingly, and when it is used you should take extra care to ensure that any user inputs that might be passed into the REST API call are properly sanitized.

3 Replies

  • AdamN's avatar
    AdamN
    Khoros Oracle
    12 years ago

    Hi Sunny,

     

    I'm not sure exactly what you mean by legacy rank. Are you simply referring to the user's current rank in the community? If so, it could be the case that the annoymous user does not have permission to make the REST API call you're attempting.

     

    I assume you're using the "rest(...)" custom Freemarker context object? If it's an issue with permissions and you want to still expose this information to anonymous users, you could use the "restadmin(...)" to make the request as an administrator user instead. This will allow you to bypass the permission issues, but I do urge caution when using this context object since you are in effect making the call as an administrator.

     

    "restadmin" should be used very sparingly, and when it is used you should take extra care to ensure that any user inputs that might be passed into the REST API call are properly sanitized.

  • Sunny's avatar
    Sunny
    Ace
    12 years ago

    hey Adam

     

    Thanks,

    that was pretty much helpful

    I was able to find out legacy rank,

    but for normal rank it retrieves "N/A"...

    How could I retrieve actual text?

  • AdamN's avatar
    AdamN
    Khoros Oracle
    12 years ago

    Hi Sunny,

     

    I guess I'm still not clear what you mean by "legacy rank" vs "normal rank". Can you please elaborate on what you mean by "legacy rank"? Perhaps this is something specific that you've setup for your community?

     

    One thing you may want to check is to ensure that each rank has a value for the "Rank name" fields when you're setting up the rank. If you haven't setup a rank name, it may come back as "N/A" from the REST API.