Forum Discussion

Sunny's avatar
12 years ago

Developing Custom Component using REST API

Hi,

 

I am developing a custom component in lithium.

Basically I am hitting an REST API call to retrieve the username of an user using its user id.

E.g.. of REST - <#assign latest_welcome_msg_author_id = rest("/boards/id/welcome/messages/latest/last_edit_author/id").value>

I am also getting the username correctly and displaying it using Freemarker Template language.

But the problem is only for one user, i.e. for that particular user I actually need to first login into my instance or else it doesn't display the username.

While all the other remaining user's name seem to display irrespective to whether I am logged in or logged out of the instance.

 

I am also attaching the screenshots to make it a bit more clearer.

 

What should I do to solve this issue?

 

before_login.PNGafter_login.PNG

  • Correct API to get User's Rank Color

     

    rest("/users/id/${user.id}/ranking/display/color")

  • It's very strange that it happens for only one user. Is there something special/different about that one user?What does the rest of your code look like? From the screenshot it looks like the HTML is not properly formatted, though that might only be happening when the error occurs. Still, seeing the rest of the code might help to troubleshoot.
  • ok got it.

     

    I was trying to get the rank color instead of user's rank color.

    But got to know a thing is that I believe rank color is not retireved when someone isn't logged in.

  • Correct API to get User's Rank Color

     

    rest("/users/id/${user.id}/ranking/display/color")