Forum Discussion

andre_fuse's avatar
andre_fuse
Contributor
16 years ago

REST API - Messages Search No Teaser Value

I want to use the API to search for messages that contain my search phrase.

 

i.e. searching for the word playstation

/restapi/vc/search/messages?phrase=playstation

 

In the search result xml, the teaser value is always null but all other fields are fine.  Should I use a different API method?  Or maybe lithium can update the API to show the teaser value?  Otherwise, I have to make an API call to retrieve the body of each message.  This way is very inefficient.

 

 

  • JakeR's avatar
    JakeR
    Khoros Oracle

    The API supports getting the following from search in a single API call

     

    (http://customer.stage.lithium.com/ppl/restapi/vc/search/messages?phrase=testing&page_size=5&restapi.response_style=view&restapi.format_detail=full_list_element)

     

    * Subject / title of post - <subject>

    * Time-stamp - <post_time>

    * URL to post (for hyperlink) – view_href attribute on <message>

    * Author – <author>

    * URL to author profile – view_href attribute on <author>

    * Message Body – <body> (requires passing an additional parameter

     

    I belive with the message body content you can then parse the XML so that you define the teaser to be however long you want it to be.

      • AdamN's avatar
        AdamN
        Khoros Oracle

        Hi lvshankar,

         

        The teaser field is user-definable field (rather than being automatically generated), but only a few interaction styles have a teaser field. I believe blogs and TKB are the only two of the current interaction styles that allow a user to set a teaser for the article.

         

        The field is returned in the REST API XML because as far as our REST API is concerened, a message is a message, regardless of whether it's from a forum, blog, idea, TKB, etc. So basically it's there to have consistent XML across all of the different interaction styles.

         

        If you're looking for a teaser in the sense of a truncated message body (rather than the user-defined teaser for blogs and TKB articles), I'd suggest checking out the example here:

        http://lithosphere.lithium.com/t5/Lithium-Developers/Stripping-HTML-from-the-message-body-returned-by-a-rest-call/td-p/30032