1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How can I call XF search from outside my forum?

Discussion in 'XenForo Development Discussions' started by rhodes, Aug 6, 2014.

  1. rhodes

    rhodes Active Member


    I would like to call the XF search from outside my forum instance and then process the returned json data.
    My homepage is located at the root domain, my xf is located at mydomain.com/community.

    My first idea was to make an ajax call similar to this one:

    /community/search/28732/?q=Deaver&o=date (search for 'Deaver' and order search results by date)

    But I'm not quite sure how I can
    * get the search token
    * get Json data / set the response type with a get parameter

    My second idea was to initialize XF from within my non xf system.
    But in this case I also don't know how I can
    * get the search token
    * pass my search string to the xf internal search to get Json data.

    What can I do? Is it possible to get search results via API calls?

    Thank you for any hint.

    Regards, rhodes
  2. Aayush

    Aayush Well-Known Member

    Most probably, you'll have to write your own API for searching. Should be pretty simple, call all the methods that are happening behind the scenes when you search for something. This would also help you bypass the xFToken validation.
  3. rhodes

    rhodes Active Member

    The most difficult part is to find the necessary information. Any ideas which functions should be called when searching via API? Is there a developer documentation for all xf functions?
    Last edited: Aug 7, 2014
  4. Aayush

    Aayush Well-Known Member


    Check this class. It should help you in creating the API.

Share This Page