Web API Controller Standardization

Asked

Viewed 62 times

1

I would like to know the following.

Imagine the following URI:

(1) api/orders
(2) api/orders/10
(3) api/orders/10/items

URI (1) and (2) I am sure they would be within a class called Pedidoscontroller, already (3), I am doubtful if it would be in the same or another class called Itenscontroller.

Which is correct?

1 answer

0

As this working micro service I believe the best way is to leave separate even

Pedidocontroller

api/orders

api/orders/10

Itemcontroller

api/item // all items api/item/{id} // item with given id

article on the subject : https://msdn.microsoft.com/pt-br/library/dn376303.aspx

  • Eduardo, good afternoon and thank you for your return. So, but if you look at the article you quoted, it does different than what you recommended, because: The method of recovering artists' albums is in Artistascontroller and not in Albunscontroller. And I understand that this is the same logic as my example, just as requests have items, artists have albums.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.