Forum Discussion

nickz's avatar
nickz
Guide
11 years ago

how do I retrieve data from our company community TKB and display them within our company website?

I'm trying to create a search widget in our company website. It will allow users to input a key word in the search box and then call an API to retrieve articles from our company community TKB and display them in the widget within our company website without having people go to our community website and search from there. Ideally, we were thinking of using an ajax call and the response should have: title, brief content, and its URL in company community TKB. It would be better if the response is in JSON format.

 

I tried the API like this:
mycompanycommunity.com/t5/forums/searchpage/tab/message?allow_punctuation=true&filter=lab…:mycompanyname-tkb&q=... 
But the API redirected me to the company community instead. What I need is to get data ONLY from the TKB and handle the response in our company website.

 

Does anyone of you have some experience with something similar? Which REST API should I use? This is very important to company success and a nifty feature to have.

 

1.png2.png3.png

 

  • You might want to add this to your search query so that it returns all message elements as part of the response:

    &restapi.response_style=view&restapi.format_detail=full_list_element

    The excerpt you highlighted is something created dynamically by cutting the body of the message in our UI. So in order to create your own excerpt, you could do the same by taking the message <body> content and cut only one part of it at a predefined number of characters.

     

     

8 Replies

  • nickz - You can use the ActiveCast, it is located here /t5/bizapps/bizappspage/tab/community%3Aadmin%3Acontent%3Aactive-cast

    and will solve your purpose.

     

    Use this ActiveCast widget to display the most recent posts from a board. Syndicated content includes the post's subject, author, date, and body text.

    Fill in the information below and click Create to generate code that you can use on the website where you want to display the ActiveCast content.

     

    Let me know if this helps.

  • FilipK's avatar
    FilipK
    Lithium Alumni (Retired)
    11 years ago

    Hi nickz, have you considered using REST API? There is an article about how to do federated search here.

  • nickz's avatar
    nickz
    Guide
    11 years ago

    Hi VarunGrazitti ,

     

    thanks for your feedback. I dont quite understand what you mean.

     

    Where is Activecast?

     

    community.lithium.com/t5/bizapps/bizappspage/tab/community%3Aadmin%3Acontent%3Aactive-cast

     

    or

     

    community.mycompanyname.com/t5/bizapps/bizappspage/tab/community%3Aadmin%3Acontent%3Aactive-cast

     

    I tried both of them, but found nothing available.

     

    The first said access denied, while the second just redirected me to community.mycompanyname.com.

  • nickz's avatar
    nickz
    Guide
    11 years ago

    Hi FilipK,

     

    I tried the API you referred. It worked!

    Thanks for your help.

     

    Now, how do I get the excerpt of articles?

    If I perform a query under knowledge base, title and excerpt both show up.

    According to the response from API, I can get anything I want, except for the excerpt of articles.

     

    excerpt.jpg

     

     

  • FilipK's avatar
    FilipK
    Lithium Alumni (Retired)
    11 years ago

    You might want to add this to your search query so that it returns all message elements as part of the response:

    &restapi.response_style=view&restapi.format_detail=full_list_element

    The excerpt you highlighted is something created dynamically by cutting the body of the message in our UI. So in order to create your own excerpt, you could do the same by taking the message <body> content and cut only one part of it at a predefined number of characters.