ContributionsMost RecentMost LikesSolutionsRe: Making secure connection b/w Custom component and Endpoint using AJAX HiPaoloT, may be you can provide some insights to this? Making secure connection b/w Custom component and Endpoint using AJAX Hi All, We are calling an endpoint from a custom component using Ajax. It works fine but we have one query - Is there a way we can authenticate the call at the endpoint that it was made from the custom component only? As the Endpoints can be accessed via browser as well, and by passing parameters, anyone can see the data. Is there a way we can fill this gap? e.g. The profile hover endpoint on lithosphere can be hit directly from browser and you just need to change the user id and you will get the respective results. https://community.lithium.com/lithosphere/plugins/custom/lithium/lithosphere2/profilehovercard?user_id=34691 This is a simple case,but still, is there a way to authenticate the call inside the Endpoint to verify that the source was the custom component and not the direct browser hit? How to read parameter from URL on the custom page We are planning to create a custom page where I would need to get the name of the parameter. /t5/custom/page/page-id/GlobalText?textName=text1 I need a way in FTL to get the value of textName. Re: Bookmark, float a thread using REST API Hi ChhamaJ- Thanks, it was indeed one issue but I had to quote 'subscription.type' as well, without those, it was giving an error of unexpected token. $.post("/restapi/vc/threads/id/"+bk_id+"/subscriptions/users/self/add", { 'subscription.type':"bookmark" }, Re: Error while reading the message Body and Labels Used this instead: <#assign tkb_body = rest("messages/id/${tkb_details.messages.topic.id}/body").value> <#assign tkb_labels = rest("messages/id/${tkb_details.messages.topic.id}/labels").labels> Bookmark, float a thread using REST API I am trying to make POST request to bookmark/ float a thread using following code, but when I check the thread, nothing happens. Below is the code, the requirements is that I want to make a custom button on the category page corresponding to each thread to let user bookmark, subscribe to email. Let me know if there is a workaround for this. <@liaAddScript> (function( $ ) { $(document).ready(function(){ $.post("http://community.demo.com/restapi/vc/threads/id/89/subscriptions/users/self/add", { subscription_type:"bookmark" }, function(data){ console.log("Success"); }); }); })(LITHIUM.jQuery); </@liaAddScript> SolvedError while reading the message Body and Labels Hi Everyone, I am trying to get the TKB articles from a category, everthing is working fine but I am getting a strange error, when I try to get the Body and the Labels, I get an error: When and why do we get this error? For "${...}" content: Expected a string or something automatically convertible to string (number, date or boolean), but this evaluated to a sequence+hash (wrapper: f.e.dom.NodeListModel): ==> tkb_details.messages.topic.body [in template "authoritative_content_category_ot" at line 7, column 172] The failing instruction (FTL stack trace): ---------- ==> ${tkb_details.messages.topic.body} [in template "authoritative_content_category_ot" at line 7, column 170] ---------- My Code to read the Body and Labels: The highlighted ones give error <#assign get_tkb = rest("categories/id/${coreNode.id}?restapi.response_style=view").category.boards> <#list get_tkb.board as tkb_board_id> <#if tkb_board_id.interaction_style == "tkb" > <#assign tkb_articles = rest("boards/id/${tkb_board_id.id}/threads?restapi.response_style=view").threads> <#list tkb_articles.thread as tkb_details> ${tkb_details.messages.topic.id} - ${tkb_details.messages.topic.subject}, ${tkb_details.messages.topic.last_edit_author.login} - ${tkb_details.messages.topic.body} - ${tkb_details.messages.topic.labels.label.text} <br> </#list> </#if> </#list> The XML response is as below: <response status="success"> <thread type="thread" href="/threads/id/119" view_href="http://community.demo.com/t5/demo-Gifts/What-is-demo-Gifts/ta-p/119"> <solutions/> <messages> <count type="int">1</count> <topic type="message" href="/messages/id/119" view_href="http://community.demo.com/t5/demo-Gifts/What-is-demo-Gifts/ta-p/119"> <board_id type="int">1</board_id> <root type="message" href="/messages/id/119" view_href="http://community.demo.com/t5/demo-Gifts/What-is-demo-Gifts/ta-p/119"/> <message_status type="message_status" href="/message_statuses/id/1"> <name type="string">Unspecified</name> <key type="string">unspecified</key> </message_status> <post_time type="date_time" view_date="03-05-2014" view_time="06:06 PM" view_friendly_date="">2014-03-06T02:06:36+00:00</post_time> <last_edit_time type="date_time" view_date="03-05-2014" view_time="06:06 PM" view_friendly_date="">2014-03-06T02:06:36+00:00</last_edit_time> <parent type="message" null="true"/> <teaser type="string"/> <views> <count type="int">5</count> </views> <labels> <label type="label" href="/labels/id/11"> <id type="int">11</id> <text type="string">demo Gifts</text> </label> </labels> <kudos> <count type="int">0</count> </kudos> <message_rating type="float">0.0</message_rating> <last_edit_author type="user" href="/users/id/53" view_href="http://community.demo.com/t5/user/viewprofilepage/user-id/53"> <login type="string">Caty</login> </last_edit_author> <body type="string"> <DIV class="lia-message-template-content-zone"><P> </P> <P>demo Gifts is a service that allows people to purchase digital gift cards for use at participating demo restaurants. The gift card is immediately delivered to the recepient via email, and does not have an expiration date.</P> </DIV> </body> <thread type="thread" href="/threads/id/119" view_href="http://community.demo.com/t5/demo-Gifts/What-is-demo-Gifts/ta-p/119"/> <board type="board" href="/boards/id/demo-gifts" view_href="http://community.demo.com/t5/demo-Gifts/tkb-p/demo-gifts"/> <subject type="string">What is demo Gifts?</subject> <id type="int">119</id> <read_only type="boolean">false</read_only> <deleted type="boolean">false</deleted> <author type="user" href="/users/id/53" view_href="http://community.demo.com/t5/user/viewprofilepage/user-id/53"> <login type="string">Caty</login> </author> </topic> <read> <count type="int">1</count> </read> <linear> <message type="message" href="/messages/id/119" view_href="http://community.demo.com/t5/demo-Gifts/What-is-demo-Gifts/ta-p/119"> <board_id type="int">1</board_id> <root type="message" href="/messages/id/119" view_href="http://community.demo.com/t5/demo-Gifts/What-is-demo-Gifts/ta-p/119"/> <message_status type="message_status" href="/message_statuses/id/1"> <name type="string">Unspecified</name> <key type="string">unspecified</key> </message_status> <post_time type="date_time" view_date="03-05-2014" view_time="06:06 PM" view_friendly_date="">2014-03-06T02:06:36+00:00</post_time> <last_edit_time type="date_time" view_date="03-05-2014" view_time="06:06 PM" view_friendly_date="">2014-03-06T02:06:36+00:00</last_edit_time> <parent type="message" null="true"/> <teaser type="string"/> <views> <count type="int">5</count> </views> <labels> <label type="label" href="/labels/id/11"> <id type="int">11</id> <text type="string">demo Gifts</text> </label> </labels> <kudos> <count type="int">0</count> </kudos> <message_rating type="float">0.0</message_rating> <last_edit_author type="user" href="/users/id/53" view_href="http://community.demo.com/t5/user/viewprofilepage/user-id/53"> <login type="string">Caty</login> </last_edit_author> <thread type="thread" href="/threads/id/119" view_href="http://community.demo.com/t5/demo-Gifts/What-is-demo-Gifts/ta-p/119"/> <board type="board" href="/boards/id/demo-gifts" view_href="http://community.demo.com/t5/demo-Gifts/tkb-p/demo-gifts"/> <subject type="string">What is demo Gifts?</subject> <id type="int">119</id> <read_only type="boolean">false</read_only> <deleted type="boolean">false</deleted> <author type="user" href="/users/id/53" view_href="http://community.demo.com/t5/user/viewprofilepage/user-id/53"> <login type="string">Caty</login> </author> </message> </linear> </messages> <title type="string" null="true"/> <board type="board" href="/boards/id/demo-gifts" view_href="http://community.demo.com/t5/demo-Gifts/tkb-p/demo-gifts"/> <id type="int">119</id> <interaction_style type="string">tkb</interaction_style> </thread> </response> SolvedBoards Page Customizations and topic options Hi Everyone, We have made several cutomizations to the boards page in past but in one of our latest communities, we have a requirement where we need to use someoptions from the topic options dropdown, "Sort by latest post" is one of those. In the boards page customizations, we use the following REST call to get the recent threads on the current board: <#assign recent_threads = restadmin("/boards/id/${coreNode.id}/threads/recent?restapi.response_style=view&page_size=${itemPerPage}&page=${page_number}").threads/> Using the page_size and page parameter, I am able to use the default pagination widget, but is there any way I can use the option which I mentioned above, to sort the threads? One example which got me curious was here http://community.eu.playstation.com/t5/PS4-General/bd-p/bEN_PS4GD They have customized the boards page but when I logged in and check, the Sort thread options from the topic options dropdown was working fine, can any one please explain how can I use these in the custom boards page threads listing component? SolvedRe: Limit in API Hits for a dayAnyone?Limit in API Hits for a day Is there any limit in the number of hits for APIs in Lithium? We have made a lot of customizations in our community using custom components/ endpoints and used extensive amount of REST APIs. Infact all the pages of our community have atleast one custom component which is called on the page load, so out of curiosity, I was wondering what if it hits the daily API limit? Are these numbers alarming? Should we be making so much of customizations to a community? Is there any limit to it? I checked our community metrics and found following details for 1 active community day: API Calls Report Summary Information METRIC VALUE Total API Calls For Period 100969 Average API Calls For Period 50484 Maximum API Calls For Period 53283 Minimum API Calls For Period 47686 API Calls Data for Period TIME VALUE 07-15-2014 53283 07-16-2014 47686