Domanda

Default webapi route - api/{controller}/{id}

In realtime scenrios may require more get and post methods

Is it recommended to change this like default routing - api/{controller}/{action}/{id}

È stato utile?

Soluzione

Usually default values are recommended values. You don't need to change this unless you have special requirements.

api/{controller}/{controller}/{id} is a non-sense because you don't have to display two times the name of the controller in the URL.

{action} is not everytime needed (if use of GET/PUT...). You may want to create api/{controller}/{action}/{id} as a second route or specify {action} in the default route as UrlParameter.Optional.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top