<?php

add_action( 'rest_api_init', function () {
    register_rest_route( 'darkey/v1', '/set_user_rating', array(
        'methods' => 'POST',
        'callback' => 'drk_user_voting',
        'permission_callback' => '__return_true',
        'args' => [
            'vote' => [
                'required' => true,
                'type' => 'string',
            ],
            'user_id' => [
                'required' => true,
                'type' => 'integer',
            ],
        ]
    ));
});