I am building an API with the help of Dingo/api extension for Laravel. As i am working with all different methods, I stumbled accross the update. Now there are a lot of discussion which method is better to use.
post or put
But for updating an existing element like an Item or Customer.. do i use Post or Put to update that specific element. so in code whichone is more effective for update:
$api->post('items/{id}/edit' , 'App\Http\Controllers\Api\ItemController@edit' );
or
$api->put('items/{id}/edit' , 'App\Http\Controllers\Api\ItemController@edit' );
POST for inserts
PUT for updates.
Nothings stops you to use them the other way around, but this is the standard.
Also, nobody is stopping you to do the update on DELETE
either, but it is a bad practice.