Forum Discussion

jasondmcclellan's avatar
9 years ago

Help with Endpoint - escaping errors in description field

I've got an endpoint that is being consumed by our parent domain to power portlets on AEM.   Recently, errors started popping up surrounding the description field.  The errors are cryptic so I've been modifying usernames and posts which seemed to fix that error only for one more to popup.     I do not have any developer support from my agency nor do I have funds to engage Lithium professional services.   

 

Has anyone run into issues with content causing errors in your endpoints?   If so how did you solve the issue?   Any help would be appreciated.

 

Below is the custom endpoint created to power a portlet with blog and forum content.    Thank you Jason

 

http://community.brocade.com/dtscp75322/plugins/custom/brocade/dtscp75322/forums_blogs_desc_for_search

 

<#include "test_macro.ftl" />
<?xml version="1.0" encoding="utf-8"?>
<channel>
<#assign posttime= http.request.parameters.name.get("posttime","1388563200000")?js_string/>
<#assign limit= http.request.parameters.name.get("limit","5000")?js_string/>

<#assign x = rest("2.0","/search?q=" + "SELECT * FROM messages WHERE depth = 0 AND conversation.style in ('forum', 'blog') and post_time > ${posttime} LIMIT ${limit} OFFSET 0"?url) />

<#list x.data.items as message>
	<item>
		<title>${message.subject?xml}</title>
		<link>${baseUrl}${message.view_href}</link>
                <pubDate>${message.post_time?date}</pubDate>
                <last_reply_time>${message.conversation.last_post_time?date}</last_reply_time>
                <last_edit_time>${message.current_revision.last_edit_time?date}</last_edit_time>
                <type>${message.conversation.style}</type>
		<author>${message.author.login}</author>
         	<labels>
        	  <#assign pre_lbl = restadmin("/messages/id/${message.id}/labels/").labels>
			<#list pre_lbl.label as lbl>
			"${lbl.text?xml}"
			</#list>
                  </labels>
                  <tags>
                  <#assign pre_tags = restadmin("/messages/id/${message.id}/tagging/tags/all").tags>
			<#list pre_tags.tag as tags>
			"${tags.text?xml}"
			</#list>
                  </tags>
                  <views>
                  <#assign viewcount = restadmin("/messages/id/${message.id}/views/count").value>
			"${viewcount}"
                  </views>
                  <kudos>
                  <#assign kudoscount = restadmin("/messages/id/${message.id}/kudos/count").value>
			"${kudoscount}"
                  </kudos>
                  <#assign blurb = utils.html.stripper.from.gdata.strip(message.teaser)>
                  <description><#if blurb?has_content> ${blurb?xml} 
			 <#else>
			 <#assign body = utils.html.stripper.from.gdata.strip(message.body)>
                    <#if body?length gt 250> ${body?substring(0, 250)?xml}... <#else>${body?xml}</#if>
			 </#if>
		  </description>
	</item>	
</#list>
</channel>
No RepliesBe the first to reply