# yatra/2.3.2/core/API/RestBase.php

Yatra – Travel Booking &amp; Tour Operator Software, version 2.3.2. 37 lines.

- Page: https://pluginprobe.com/plugins/yatra/2.3.2/code/core/API/RestBase.php
- Raw: https://pluginprobe.com/plugins/yatra/2.3.2/raw/core/API/RestBase.php
- Modified: 2022-11-10T16:58:10+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/yatra/2.3.2/code/core/API/RestBase.php#L10-L20`.

```php
<?php

namespace Yatra\Core\API;

abstract class RestBase
{
    protected $rest_route_id = '';

    protected $namespace = YATRA_REST_WEBHOOKS_NAMESPACE;


    protected $method = \WP_REST_Server::READABLE;


    public function __construct()
    {
        add_action('rest_api_init', array($this, 'register_routes'));
    }

    public function register_routes()
    {
         register_rest_route($this->namespace, $this->rest_route_id, array(
            'methods' => $this->method,
            'permission_callback' => array($this, 'validate'),
            'callback' => array($this, 'handle')
        ));
    }

    abstract public function validate(\WP_REST_Request $request);

    abstract public function handle(\WP_REST_Request $request);

    abstract public static function init();

}


```
