Support » Plugin: WordPress REST API (Version 2) » Custom Endpoints

  • Nic Ford

    (@nicdford)


    Does the rest api support custom endpoints as letters or only as integers? For example could an endpoint pass a slug?

    so like: /wp-json/portfolio/v1/clients/client-name instead of /wp-json/portfolio/v1/clients/201

    register_rest_route ('portfolio/v1', '/clients/(?P<slug>\d+)/', array(
            'methods' => 'GET',
            'callback' => 'get_industry'
        ) );

    https://wordpress.org/plugins/rest-api/

  • The topic ‘Custom Endpoints’ is closed to new replies.