How to do rest APi with wordpress

First of all you should re-submit permalink to enable rest api in your wordpress. your rest api url is:
http://your-site.com/wp-json/

And you can register new endpoind with bellow code:

add_action( 'rest_api_init', function () {
    register_rest_route( 'myplugin/v1', '/author/(?P<id>\d+)', array(
        'methods' => 'GET',
        'callback' => 'my_awesome_func',
    ) );
} );