What is the correct RESTful implementation in WebAPI2?

In fact, I found a lot of opinions on this topic, but no one convinces me of the correctness. More specifically, I have the following questions:

Singular or plural, or both

  • Is there a right and wrong way?

    Standards and agreements exist for some reason, I do not believe that one day I can agree - this is just a matter of taste. Are there no recommendations or standards? No powers terminating Fieldings?

What will return IHttpAction? And what should they contain?

  • Get - return Ok ();
  • Post-return Created ();
  • Put - return (Put? Ok?)
  • Delete - return (deleted? Good?)

What needs to be returned in the created ( place )?

Assuming the controller route is "api / v1 / model" if it is

, , API.

+4
1

Q:

. . , .

:

/getAllCars
/CreateNewCar
/DeleteAllRedCars

. .

/cars instead of /car
/users instead of /user
/products instead of /product

, , :

GET/tickets -

GET/tickets/12 -
POST/ -
PUT//12 - № 12
PATCH//12 - # 12
DELETE//12 - №12

.

GET/cars/711/drivers/ 711

Q: ()?

200 OK - GET, PUT, PATCH DELETE. POST, .

201 Created - POST, . ,

, .

REST, . PDF apigee.com, REST API , .. Facebook, ..

+2

Source: https://habr.com/ru/post/1653101/


All Articles