How can I call XF search from outside my forum?

rhodes

Active member
Hello,

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
 
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.
 
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.

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:
XenForo_ControllerPublic_Search

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