Streamlinesx opened a new issue, #12316: URL: https://github.com/apache/apisix/issues/12316
### Description Currently when fetching a consumer by ID, and no consumer exists for this ID, the admin API replies with a 404 response, which is typically used for when the endpoint can't be found. However, the API is available and simply can't find a key for this given ID. For instance, when calling the API with this call: `curl -i "http://apisix:9180/apisix/admin/consumers/4ab17397"` And no consumer exists for this ID, the API replies: ``` HTTP/1.1 404 Not Found Date: Wed, 11 Jun 2025 11:27:52 GMT Content-Type: application/json Transfer-Encoding: chunked Connection: keep-alive Server: APISIX/3.9.1 Access-Control-Allow-Origin: * Access-Control-Allow-Credentials: true Access-Control-Expose-Headers: * Access-Control-Max-Age: 3600 X-API-VERSION: v3 {"message":"Key not found"} ``` This makes no sense because 404 NOT FOUND is usually for when an API endpoint can't be found and is a response of an error category. This makes it hard to safely implement an interface for the admin API, and it's more difficult to make the difference between not having found an entity, or the actual API endpoint...sure, the body with the message exists, but it's still not proper usage of HTTP response codes. In this case, the process finished successfully and there is simply no result. The response should thus be either a 200 OK with an empty body, or a 204 NO CONTENT -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@apisix.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org