I have a WordPress.org site which takes user input, searches a custom database and displays the results of the query. I have this working using the wpdb class. Now I’m trying to get this working for an android app.
From what I understand, building a RESTful server is the current ‘best practice’ for this kind of thing. I have looked into some plugins that could help me do this, and I have come across:
-
json-rest-api – It seems to me that this only exposes the core WordPress functionality (ie. posts, pages, users, etc.) and I can’t see how to get this to execute custom queries on non-default tables.
-
This blog post says that wp mvc does exactly what I want, except it hasn’t been updated in over 2 years, so that kinda rules that out.
-
There is also Jetpack but from what I’ve seen, the json-rest-api is the updated version of this and it seems to only give core functionality as well.
Is there a way to make any of these plugins work for custom endpoints? Or are there other plugins I haven’t found yet?
If I don’t use a plugin, I figure I would have to roll my own. I can do this either from scratch (using wpdb
, msqli
or something), or with the help of an API such as Restler.
If I do roll my own should I create a template in my theme, do the REST stuff in there and assign that theme to a page within the dashboard? Or would it be better to have another server running separate to WordPress for this?
As far as I can see, these are my only options. I would like to know what are the recommended best practices for this kind of thing. I find it hard to believe that no one else has done this. Are there any options I have overlooked?