Forum Discussion

cike's avatar
cike
Champion
7 years ago

Same API call - different results

Hi there,

currently I'm facing a strange thing using Lithium APIv1. I set up two different endpoints and each of them makes this API call:

<#assign roles = restadmin("/users/id/${uid}/roles").roles />

My test user has 4 roles assigned. One of my endpoints returns the correct 4 values. But the other one returns a list size of only 1 and the response can't be looped with freemarker.

I also tried to use hard-coded uid values, but the result is still the same.

 

***Update***

When sending the same API call from a custom component, I also get the correct dataset in response. Seems that only the specific endpoint run into this problem.

 

Has anyone faced a similar issue in the past or has some ideas/hints what went wrong here?

 

Thanks and best regards,

Christian

  • cike's avatar
    cike
    7 years ago

    Parshant - Thanks for your reply.  The "?c" operator did not work in this case, because my uid is already a string.

    After some deeper investigation and rebuilding my endpoint step by step I found the cause of this issue: It was a simple and small typo. :smileyvery-happy:

  • cike

    Give a try to this code.

    <#assign roles = restadmin("/users/id/${uid?c}/roles").roles />

    If it doesn't' work for you then share your endpoint code over here for free marker list as well.

     

    • cike's avatar
      cike
      Champion

      Parshant - Thanks for your reply.  The "?c" operator did not work in this case, because my uid is already a string.

      After some deeper investigation and rebuilding my endpoint step by step I found the cause of this issue: It was a simple and small typo. :smileyvery-happy: