diff --git a/extending-the-rest-api/adding-custom-endpoints.md b/extending-the-rest-api/adding-custom-endpoints.md index 811cc47..7ac3542 100644 --- a/extending-the-rest-api/adding-custom-endpoints.md +++ b/extending-the-rest-api/adding-custom-endpoints.md @@ -49,6 +49,10 @@ Right now, we're only registering the one endpoint for the route. The term "rout For example, if your site domain is `example.com` and you've kept the API path of `wp-json`, then the full URL would be `http://example.com/wp-json/myplugin/v1/author/(?P\d+)`. +[alert] +On sites without pretty permalinks, the route is instead added to the URL as the `rest_route` parameter. For the above example, the full URL would then be http://example.com/?rest_route=/myplugin/v1/author/(?P\d+) +[/alert] + Each route can have any number of endpoints, and for each endpoint, you can define the HTTP methods allowed, a callback function for responding to the request and a permissions callback for creating custom permissions. In addition you can define allowed fields in the request and for each field specify a default value, a sanitization callback, a validation callback, and whether the field is required.