Forum Discussion
Hi hurebelo ,
You could use the following REST V2 call to get all the details in a single call.
<#assign query="SELECT board.title,body FROM messages WHERE subject MATCHES 'test' OR body MATCHES 'test' LIMIT 1000" />
<#assign x= restadmin("2.0","/search?q=" + query?url) />
Response would be as follows:
{
"status" : "success",
"message" : "",
"http_code" : 200,
"data" : {
"type" : "messages",
"list_item_type" : "message",
"size" : 3,
"items" : [ {
"type" : "message",
"body" : "<P><SPAN>body123 test</SPAN></P>",
"board" : {
"type" : "board",
"title" : "boardTitle1"
}
},
{
"type" : "message",
"body" : "<P>test body</P>",
"board" : {
"type" : "board",
"title" : "boardTitle2"
}
},
{
"type" : "message",
"body" : "<P><SPAN>body123 test test</SPAN></P>",
"board" : {
"type" : "board",
"title" : "boardTitle1"
}
} ]
},
"metadata" : { }
}
Now, you can get count and board title as follows:
<#assign count = x.data.size />
<#list x.data.items as message >
<#-- you can access board title here as message.board.title -->
</#list>
Let me know if this gives any error, I tried and its working fine.
Regards,
Madhu
Related Content
- 5 years ago
- 2 years ago