404/500 error on /wp-json

Are you trying to use that function without first initiating it in an action? It should be done like so:

add_action( 'rest_api_init', 'add_custom_users_api');

function add_custom_users_api()
{
    register_rest_route( 'route', array(
                                'methods' => 'GET',
                                'callback' => 'function',
                       ));
}

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)