Forum Discussion
Hi Zach,
I'm not sure I fully understand the exact use case you're battling with, but if you're just looking for a way to access the same message from a different URL, I think I can help. You mentioned that you've created a custom endpoint. In this endpoint, I assume you're getting a collection of messages and then outputing details of each message.
The Message object returned from the REST API has a "view_href" attribute associated with it that will give you the "SEO friendly" URL that you would most commonly find the in UI. You can see this attribute (and more) by appending the parameter/value pair "restapi.response_style=view" to your request URL. More details on that here: http://lithosphere.lithium.com/t5/rest-api/bd-p/developers-rest-api?page=apiresponse
Here's an example call using the parameter mentioned above:
http://lithosphere.lithium.com/restapi/vc/messages/id/107639?restapi.response_style=view
And a sample (condensed) response:
<response status="success"> <message type="message" href="/messages/id/107639" view_href="http://lithosphere.lithium.com/t5/developers-discussion/2-crawl-lists-with-different-crawl-message-folders/m-p/107639#M3996"> <id type="int">107639</id> ... </message> </response>
You can see this message has a "view_href" attribute with a value of:
http://lithosphere.lithium.com/t5/developers-discussion/2-crawl-lists-with-different-crawl-message-folders/m-p/107639#M3996
If you're making your call in a custom component using the "rest" or "restadmin" context object, you don't need to worry about adding the "restapi.response_style" parameter. It's automatically added for you when you use the context objects. You can just directly access the attribute on the message object, for example:
<#assign message = rest("/messages/id/107639").message /> ${message.@view_href}
Here are some additional details for accessing attributes in Freemarker:
http://freemarker.org/docs/xgui_imperative_learn.html#autoid_70
I hope this helps! If there's something different you're looking for, please let us know.
Related Content
- 9 years ago