Add support for multiple endpoints at the same address
sitole opened this issue · 3 comments
Standardized REST API support this as valid (and most used) behaviour.
api/articles
Return list of articles
api/articles?id=123
Return single article by ID
It is more intuitive in documentation and changes in the future.
This issue points to weakness of this system > strictly mapped URL to method name.
I want a mapper (use a pseudo annotation at best) to register an endpoint.
cc @janbarasek
@sitole I think this is anti pattern.
Now ApiManager check all endpoint type names and each name must be unique.
Please check it out: https://github.com/baraja-core/structured-api/blob/master/src/ApiManager.php#L143
I think you can use multiple methods in same endpoint or extends.
@janbarasek Yeah we talk about it. In our case we can use api/articles
and api/articles/detail?id=123
, but there are some global standards. Take a look.
https://docs.microsoft.com/en-us/azure/architecture/best-practices/api-design#organize-the-api-around-resources
https://docs.microsoft.com/en-us/azure/architecture/best-practices/api-design#organize-the-api-around-resources
https://adventure-works.com/api/orders/123
return only one entity
https://adventure-works.com/api/orders
return collection of entities.
Simply clever.
If we want globally used lib we must follow global standards.
This is at odds with the design of this package, which aims to provide a simple interface.