mikyll commented on issue #12316: URL: https://github.com/apache/apisix/issues/12316#issuecomment-2963254457
@Streamlinesx > what a 'resource' is, as in: is it an entity on the database, or is it an endpoint path on the backend In RESTful APIs, each resource/entity is represented by a unique URI. This is typically implemented through path parameters, e.g. in APISIX Admin API it's something like `/apisix/admin/:resourceType/:resourceId`). In APISIX context, the "entity" Consumer maps to a key in Etcd database (unless APISIX is deployed in Standalone mode), and each resource of APISIX's defined types, can be retrieved via its corresponding URI: `/apisix/admin/consumers/:id`. Depending on the HTTP method of the request, you can perform different operations on resources: - `GET` for fetching resources - `POST` to create a new resource - `PATCH` to update an existing resource - `PUT` to update (or create if not existing) a resource - `DELETE` to delete a resource > does /consumers/{id} count as a valid resource no matter what the {id} parameter is initialized It depends on what you mean for "valid". Endpoint `/apisix/admin/consumers/:id` is used to interact with resources of type "consumers", and consumer is a valid type of resource, in the APISIX context. However, each consumer is identified by an unique ID and if you try, for example, to add a consumer with an already existing ID or without one the API will return an error. Consider that `4xx` status codes refer to client "errors": - `400 Bad Request`, wrong request (bad formatting, missing fields, validation failed, etc.) - `401 Unauthorized`, wrong or missing apikey - `404 Not Found`, URI not handled, which could mean that the resource type doesn't exist or a specific resource (with a given ID) doesn't exist - `405 Not Allowed`, the HTTP method is not allowed For a more comprehensive explaination, I found this Microsoft post which explains REST design pattern: https://learn.microsoft.com/en-us/azure/architecture/best-practices/api-design Hope that helped 🙂 -- 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 For queries about this service, please contact Infrastructure at: us...@infra.apache.org