FreeMarker Novice - Making two rest calls in custom component
I'm new to developing and using FreeMarker. I'm learning and reading the various samples and figured out how to reference items in an API call. I'm getting stuck trying to reference a rest call to a different API from the initial rest set. I'm trying to make something similar to "Latest Solution" panel which lists the subject and board as a custom comonent. Below is my attempt, but would appreciate an expert who could guide me on how to reference the second rest information to pull the 'board name'.
Thanks,
Tim
Here is my white boarding of what I want to accomplish.
Make API call to get solutions
https://community.foo.com/restapi/vc/boards/id/foobar/solutions/recent?restapi.response_style=view&page_size=30&format_detail=full_list_element
Loop thru each thread in solution list
For each thread read the following feilds (title, URL, board the solution is posted, URL for the board)
Print those values
End Loop
<ul> <#list rest("/boards/id/foo/solutions/recent?page_size=10&response_style=view").threads.thread as thread> <#assign rest("/boards/nested").boards.board.title as title> <li> <a href="${thread.solutions.solution.@view_href}">${thread.messages.topic.subject}</a><br> <a href="${thread.board.@view_href}">${title}</a><br><br> </li> </#list> </ul>
Thanks, but that is a bit overwhelming for a novice. I went over my question with my boss and came up with the following below. Since the title didn't exist in the API call I was making I needed to reference another AP call. This was my original question. You can see that we can reference another rest call and concatenate the title to get the board title.
<#list rest("/boards/id/[foo]/solutions/recent?page_size=10&response_style=view").threads.thread as thread> <li> <a href="${thread.solutions.solution?first.@view_href}">${thread.messages.topic.subject}</a> <br /> <a href="${thread.board.@view_href}"> ${rest(thread.board.@href + "/title").value} </a> <br /><br /> </li> </#list>