I'm having issues adding a custom REST API route to Wordpress. Using my own plugin, i've registered the route as followed:
add_action( 'rest_api_init', function() {
register_rest_route( $namespace, 'handler_mijnenergie', array(
'methods' => '\WP_REST_Server::CREATABLE ',
'callback' => [ $this, 'handle_energie_data' ]
), false );
} );
When calling the namespace "/wp-json/watz/v1" I get a correct response in Postman that the route is shown.
However, when i try to access the route request directly, i get thrown a 404 error. So far I've tried:
- Rewriting the permalinks
- Using standard Wordpress .htaccess
- Disabling plugins
- Changing method/namespace & request
- Testing other plugin routes like Yoast or Contact Form 7 (they work)
Any idea what could be causing the issue here and what I need to alter to get this working?