c# - Build an API for Multiple -


i'm building api using webapi accessed via ajax calls. however, api controller need more 1 post method. understand can specify {action} in routing, because i've seen not recommended - using right tool? 2 questions:

  1. is web api best tool this, or there else should using?

  2. why should not use more 1 post method in webapicontroller? including {action} in routing enough solution problem?

1. web api best tool this, or there else should using?

i think webapi fine choice you, regardless of whether have 1 or many post calls per controller.

2. why should not use more 1 post method in webapicontroller?

to remain restful you'll want controller per entity type. without getting deep details, post against specific type of entity should 'add entity' call, , why have more 1 of those? having said that, don't have restful... if requirements suite multi-post model go it, can refactor later if necessary.

...is including {action} in routing enough solution problem?

again, if goal restful isn't great practice. however, if have needs best achieved using action routings go it. rest not model.


Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -