• Hi,

    yesterday I read this post about the upcoming WP REST API: https://poststatus.com/wordpress-json-rest-api/

    As I developer, which also has experience with using / building RESTful APIs, I really like the project. However I have some questions to it.

    As mentioned in the post you will be able to use this API to do a lot of stuff and many CRUD operations. I am currently developing a plugin which will offer some functions for Theme developers for easy content display. But this could also be done using the new REST API. Do you think this would be a better solution? So the Theme developer just calls this REST url and receives the content as JSON?

    I also thought about implementing a custom REST API for my plugin in the future. If I would do that, should I use the api myself (Eating your own dog food) or should I continue using WP functions?

    You see, plugins like WooCommerce and EDD are offering an API for Third-Parties. If I am going to offer that too, should / can I use an REST API instead?

    So the more general question would be: When should I use the REST API and when should I use WP Functions and offer custom functions to third-parties?

    I hope I did not confuse you – however I am confused ^^

Viewing 3 replies - 1 through 3 (of 3 total)
  • Tim Nash

    (@tnash)

    Spam hunter

    So the REST API is coming to core the version that is available on the plugin is more a preview then the finished product.

    The REST API has been coming to core for a long time, however there is perhaps more momentum around it now then there has been historically.

    It is easy to use an to expand, but any expansions, at the moment will rely on the user having the API plugin installed. Which leaves an uncomfortable dependency especially for themes.

    For my own take, I use the REST API as is currently and expansions, I have several internal plugins that make use of it and extend it as well as using it within themes. However I while I would be happy to add end points to WP-API in a plugin today, in the same way I would do so for WP-CLI I would not personally use it as a core of a product which I intended to distribute.

    So for me it’s stable, it’s useable and it’s helpful perfect for internal projects, client projects etc and certainly something you could put at the core. It’s worth providing options for extracting data but you can’t rely on it being on an install.

    So for distributing unless you fancy the fun of dependency hell it may be worth waiting.

    This is just my 2p worth though, and a counter to this, the more its used, tested, and issues raised the quicker it will get into core, so if people start to use and depend on it large scale, which can only happen really with public distribution the quicker it will come.

    Thread Starter Hans-Helge Buerger

    (@obstschale)

    Thx Tim. Your answer makes a lot of sense.

    But lets assume for a moment the REST API is in the core and all my users are up-to-date and don’t rely on a “REST plugin” to be installed. Would you mainly use the API?

    Tim Nash

    (@tnash)

    Spam hunter

    The REST API offers a lot of possibilities ?? so I think for a lot of cases I would probably end up using the REST-API though obviously its very much on a case by case basis. So not sure if I would mainly use it, but I certainly would use it, where I thought it was a good fit.

    To give you an idea of a couple of places where I’m currently using it, one for Mobile apps, combined with PhoneGap, Admin interface for internal plugins, with extended API for plugin data and using Backbone for the interface. I’ve also played around with Backbone “onepage” app front end which was interesting experiment, though I really am only just getting use to backbone so was a bit hacky.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘WP REST API – when to use it?’ is closed to new replies.