Extending WordPress REST API

I’m trying to create an API where external clients can authenticate users and reset their password through a REST API. I’ve already seen this: External WordPress API. However, it looks like this is not possible through the this plugin.

Are there any way of extending this API with my own methods? How would one implement authentication of users and reset password functionality?

I also want to create some other methods which will call an external API. It looks like it’s possible to create a JSON (REST?) API through this plugin: https://wordpress.org/plugins/json-api/. However, I haven’t tried that out yet.

Are there any simple way to create a REST API to support all this functionality?

1 Answer
1

There are no answers here yet, but atleast we ended up using a combination of WP REST API and WP OAuth Server.

The WP REST API was really easy to work with, as it provided a common framework to respond to HTTP requests. I found it similar to ASP.NET Web API, as that’s the framework I’m more familiar with. It also gave us a framework (MVC) to create a HTTP response, and it serialized all our objects to JSON, like you can expect.

The WP OAuth Server helped us achieve OAuth 2 authentication, as the API needs to be protected somehow. Also, an app is going to integrate against this API, and it makes sense to use an OAuth flow with user credentials etc. One caveat here is OAuth 2 requires HTTPS.

Leave a Comment