0

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}

Ram
  • 57
  • 2
  • 10
  • Usually default values are recommended values. You don't need to change this unless you have special requirements. – glautrou Aug 07 '13 at 09:38
  • Add one more route: `api/{controller}/{action}/{id}` – cuongle Aug 07 '13 at 09:39
  • Also `api/{controller}/{controller}/{id}` is non-sense, why do you want to display your `controller` name two times in the URL? – glautrou Aug 07 '13 at 09:39
  • @Cuong Le: It depends on the needs, but `{action}` is not everytime needed (if use of GET/PUT...). He may want to create your route as a second route or specify `{action}` as not mandatory – glautrou Aug 07 '13 at 09:43

1 Answers1

1

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.

glautrou
  • 3,140
  • 2
  • 29
  • 34