WordPress Plugin Development Series (44/95). Prefer one article? Read the complete WordPress plugin development tutorial.
Short description
Define namespace, route, methods, permission_callback, and args schema.
Custom route
add_action('rest_api_init', function () {
register_rest_route('acme/v1', '/items', [
'methods' => 'GET',
'callback' => 'acme_rest_items',
'permission_callback' => '__return_true',
]);
});