TL;DR: Scroll down to the bottom to see the snippet
I have been using the WordPress REST API on a personal project for a little while now. However I was still using v1 of the plugin. With WordPress 4.4 on its way, shipping with half of the API included in Core, it was time for the project to move to v2 to ensure long time compatibility, and be able with WordPress 4.5 or 4.6 to get rid of the plugin.
This was not nearly as easy as I was expected, most functions were renamed and a fair amount of the logic of how to extend the API has changed a lot. Most changes are very logic and clearly made to ensure a smooth conflict free experience for most users. But for me it meant refactoring a fair amount of my plugin.
On this project I use WordPress as the back-office of a web app, that has not much in common with your classic blog/website. So I had no interest in the default WordPress endpoints and was only using my custom endpoints.
Therefor, I was looking on ways to remove the default WordPress Endpoints, and here is what I found by digging into the source code of the plugin.
The V1 way, which was a little hacky, remove everything except the / and then make sure you create your own routes with a lower priority:
The V2 version based on V1 was simply changing the filter name:
However, while looking for something else I found a much cleaner way to do that, at least in V2, I discovered that all the default endpoints were created by an action, and all you had to do was remove the action the remove the endpoints:
Now my API in clean and ready to be extended with my custom endpoints!