Friday, March 30, 2018

"405 Method not allowed" in Laravel 5.6.14 - development

"405 Method not allowed" in Laravel 5.6.14

I am just learning laravel resource methods to build a basic API. Below is the code of my api.php file that shows all the API routes.

// List Articles
Route::get('articles', 'ArticleController@index');

// List Single Article
Route::get('article/{id}', 'ArticleController@show');

// Create New Article
Route::post('article', 'ArticleController@store');

// Update Article
Route::put('article', 'ArticleController@store');

// Delete Article
Route::delete('article/{id}', 'ArticleController@destroy');

This works perfectly on get and delete methods. But for Post method, it is throwing error “405 Method not allowed”. I am using Postman to test the API calls.

To be specific, below is the exact error Postman shows

Symfony  Component  HttpKernel  Exception  MethodNotAllowedHttpException

Also attaching screenshot of Postman
enter image description here



from Laravel Questions and Answers https://laravelquestions.com/php/405-method-not-allowed-in-laravel-5-6-14/
via Lzo Media

No comments:

Post a Comment