Tagged: 

  • Christopher Collman

    Member
    December 30, 2024 at 3:56 am

    Following up on my previous error in Postman, Here is the error:

  • Hasan

    Administrator
    December 30, 2024 at 6:16 am

    Hi Chris, the route not found means the API endpoint is not registred.

    can you please first check your permalink structure and save it.

    second, try the following basic snippet, and see if the route work so we can isolate the issue:

    add_action('rest_api_init', function () {
        register_rest_route('test/v1', '/hello', array(
            'methods' => 'GET',
            'callback' => 'test_endpoint_callback',
            'permission_callback' => '__return_true'
        ));
    });
    
    function test_endpoint_callback($request) {
        return array(
            'status' => 'success',
            'message' => 'Hello from the test endpoint!'
        );
    }

Log in to reply.