Forum Discussion

allensmith81's avatar
13 years ago

REST API : Run a search from a specific category

Hi,

 

If I want to run a search from a custom page on all posts in a specific category how would i do this?

 

lets say I have a category called 'Test'

 

Also the reverse of this, how could i run a search on the rest of the community but exclude the catergory test?

  • Hi Allen,

     

    To run a category search, you'd use the following call -

     

    http://community.lithium.com/community-name/restapi/vc/categories/id/support/search

    ...where support is the category id of the category you want to run a search for. Extra parameters/arguments can be added to this call such as ?q=test to specify the term (or terms) to search as well as much more. I would very much recommend checking out our javadocs on REST for more information:

     

    http://lithosphere.lithium.com/t5/Documentation-TKB/Admin-Guide-REST-API-JavaDocs/ta-p/5966

     

    As for searching the entire community sans a specific category, there is not a simple way to do this by means of a single call. A custom component could be built to search specified categories and you would simply omit that one from the list, however there is not a parameter that can be attached to a search call that will let you exclude a particular category.

     

    I hope this helps; please let me know if I can be of further assistance.

1 Reply

  • JeffS's avatar
    JeffS
    Lithium Alumni (Retired)
    13 years ago

    Hi Allen,

     

    To run a category search, you'd use the following call -

     

    http://community.lithium.com/community-name/restapi/vc/categories/id/support/search

    ...where support is the category id of the category you want to run a search for. Extra parameters/arguments can be added to this call such as ?q=test to specify the term (or terms) to search as well as much more. I would very much recommend checking out our javadocs on REST for more information:

     

    http://lithosphere.lithium.com/t5/Documentation-TKB/Admin-Guide-REST-API-JavaDocs/ta-p/5966

     

    As for searching the entire community sans a specific category, there is not a simple way to do this by means of a single call. A custom component could be built to search specified categories and you would simply omit that one from the list, however there is not a parameter that can be attached to a search call that will let you exclude a particular category.

     

    I hope this helps; please let me know if I can be of further assistance.