Frage

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}

War es hilfreich?

Lösung

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.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top