Understand the most common API response patterns.
These examples are based on verified production responses and WordPress REST behavior.
missing_api_key
Returned when the route exists and expects an API key, but the request is unauthenticated.
{
"code": "missing_api_key",
"message": "API Key required",
"data": {
"status": 401
}
}
rest_no_route
Returned when the URL and HTTP method do not match a registered route. This often happens
when testing a POST or PUT endpoint with a browser or a raw
GET request.
{
"code": "rest_no_route",
"message": "未找到匹配 URL 和请求方法的路由。",
"data": {
"status": 404
}
}
Troubleshooting flow
- Confirm the route path is correct.
- Confirm the HTTP verb matches the documented endpoint.
- Add the Bearer API key header.
- Retest with a JSON-capable client such as
curlor Postman.
Recommended practice
Log the response body for failed requests. On WordPress REST routes, the error code is often
more useful than the HTTP status alone.