Forum Discussion

micha80's avatar
micha80
Expert
10 years ago

How to iterate through rest api result

Hi all,   I have tried a lot and now I am stuck. I loaded the user data from the following V1 Rest API Call:   rest(/users/id/XXX?restapi.response_style=view").response.user   Then I want to ac...
  • PaoloT's avatar
    10 years ago

    Hi micha80 

     

    have a look at the below sample code:

    <#assign test = rest("/users/self?restapi.response_style=view").user />
    
    <ul>
    <#list test.profiles.profile as prf>
      <li>Profile '${prf.@name}' : ${prf}</li>
    </#list>
    </ul>

     It will generate a list of all the key/value pairs for the currently logged in user (REST v1)

     

    Hope it helps,