We've recently started working on an API, and I'm running into a philosophy issue. This is only my second API I've worked on, but the standard I've seen for retrieving a single model is always a GET, and the endpoint is something like api/model/1
, with 1 being the ID. However, my coworker is REALLY adamant about not passing any data through a URL, and wants to use POST instead and send the ID through the body. His reasoning is that he feels it's a security risk.
At the same time, he wants to follow a philosophy of one POST per file. This means we need a file for UpdateModel, DeleteModel, and EditModel.
What I'm proposing is we follow this structure:
GET /api/Model Get all to-do items
GET /api/Model/{id} Get an item by ID
POST /api/Model Add a new item
PUT /api/Model/{id} Update an existing item
DELETE /api/Model/{id} Delete an item
But he's proposing something like this:
GET /api/Model Get all to-do items
POST /api/Model Get an item by ID
POST /api/Model Add a new item
POST /api/Model Update an existing item
POST /api/Model Delete an item
Is there anything to my coworkers philosophy that I'm not understanding?