How would you design an SOAP/REST API with collection as input parameters?
I am designing a wcf web-service that will support both REST and SOAP interfaces. As methods i am looking at supporting the following type of methods:
GetClientByID(int ID)
GetClientsByID(List&l开发者_StackOverflow中文版t;int> ID)
GetClientByEmail(string Email)
GetClientsByEmail(List<string> Email)
I also will need to support 15-20 different queries like that above, having 4 separate per query means a lot of methods to support.
How would you design a API like this that needs to support the case above where I might want to ask for multiple objects in the same request and sometime just ask for a single one? And at the same time be SOAP/REST friendly? Or am I overcomplicating things?
Should i make all input Lists? instead of having a separate GetSingle method?
And at the same time be SOAP/REST friendly?
I'd say WS-*/REST friendly. Nothing stops you from having SOAP as a resource format in your REST service.
Though i don't see the reason to have both WS-* and REST supported (but requirements are requirements...) you should have your core application independent of the 2 styles, then add a layer on top of it that would serve as an adapter. One adapter API for REST and one for WS-*
精彩评论