Skip to main content

API Routes

Vasyl MartyniukLess than 1 minute

Definition

class AAM_Framework_Service_ApiRoutes {

    public deny(mixed $api_route) : bool
    public allow(mixed $api_route) : bool
    public reset(mixed $api_route = null) : bool

    public is_denied(mixed $api_route) : bool
    public is_allowed(mixed $api_route) : bool

}

The $api_route is used to define a single API route, specifying the endpoint URL and HTTP method. The $api_route can take one of three forms:

  1. Instance of the WP_REST_Request class. If identifier is an object of the WP_REST_Request class, the get_route() method retrieves the endpoint URL, and the get_method() method fetches the HTTP method.

  2. String combining HTTP method and endpoint. If identifier is a string containing a space, it is assumed to represent the HTTP method and endpoint (e.g. 'POST /aam/v2/jwt').

  3. Associative array with endpoint and method keys. If identifier is an array, the endpoint and method values are extracted using their respective keys.

Virtual Assistant