mardi 24 mai 2016

JSON payload with POST to laravel store method

I am using laravel RESTful controllers for use with a JSON API

Route::resource('api/v1/users', 'UserController');

The controller has a number of methods/actions which the HTTP verbs correspond to. The store action corresponds to the POST verb.

When I POST a JSON payload to api/v1/users/6/ I instead hit the show method which is meant to use GET.

If I POST the JSON payload to api/v1/users/ as is listed in the docs, I instead hit the index method which is also GET.

If I use PUT, the update method is correctly called. If I use DELETE the destroy method is correctly called. If I use GET on api/v1/users/ and api/v1/users/1/ the index and show methods are correctly called.

I cannot get the store method to trigger at all. I am using Postman to test



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire