Support the ongoing development of Laravel.io →
Requests Input
Last updated 2 years ago.
0

How are you passing the parameters with Postman?
Please post some code.

Last updated 2 years ago.
0

This is my controller, the store method works well: http://laravel.io/bin/bPb And here is how I use postman: http://s13.postimg.org/4o0raxufr/postman.jpg

Last updated 2 years ago.
0

Laravel cheats with PUT/PATCH etc requests. These need to be POST requests with the extra POST variable '_method' set to the request type (e.g.) PUT.

http://laravel.com/docs/html#opening-a-form (read the read box in this section)

Enjoy!

Last updated 2 years ago.
0

Laravel cheats because html forms only support GET and POST, but it does understand a real PUT/PATCH request.

The problem looks like lies in Symfony it can't parse the data if it's multipart/form-data, as an alternative try using x-www-form-urlencoded content disposition.

Last updated 2 years ago.
0

Learn something new every day. cheers @tlgreg

Last updated 2 years ago.
0

well, finally I'm not sure about what happens, the put/patch requests go to the right controller method but the inputs couldn't be gotten. I had to use post requests instead of put/patch, breaking the REST best practices :c

Last updated 2 years ago.
0

Is there any update to this question?

I've also tried to use PUT/PATCH, here is the postman: http://screencast.com/t/BNY9sPAhlfrg

However the Input::all() is empty each time.

Any thoughts?

Last updated 2 years ago.
0

ok, it looks like in postman you should point that the data you send is 'x-www-url-formurlencoded'

Last updated 2 years ago.
0

Just wondering if this will be "fixed"? I realise you can add an extra form data element "_method" = "PATCH" while posting as POST verb but i'd prefer to just post with verb of PUT or PATCH.

Last updated 2 years ago.
0

Wow, thanks guys for figuring this out! I just spent about an hour trying to find out why my API wont work on PUT/PATCH. My issue was exactly the same with POST working fine but updates had an empty request body when testing via Postman.

I'm glad I finally found this thread and an answer after severely doubting my understanding of Laravel 5's routing and the new FormRequest validation.

Last updated 2 years ago.
0

PavelPolyakov said:

ok, it looks like in postman you should point that the data you send is 'x-www-url-formurlencoded'

@canfiax Check this

Last updated 2 years ago.
0

PavelPolyakov said:

ok, it looks like in postman you should point that the data you send is 'x-www-url-formurlencoded'

Thanks a lot

Last updated 2 years ago.
0

Anyone worked out how to get this working with PUT/PATCH and form-data? I need to submit files along with the request. For now I've fallen back to using a POST with the _method = PUT but would ideally like a nicer way of dealing with this.

0

POST and PUT use the URL-Params not the form data. Click on the "URL-Params" Button next to select method button.

0

multipart/form-data via PUT intentionally does not work in php: http://php.net/manual/en/features.file-upload.put-method.php

0

tlgreg said:

Laravel cheats because html forms only support GET and POST, but it does understand a real PUT/PATCH request.

The problem looks like lies in Symfony it can't parse the data if it's multipart/form-data, as an alternative try using x-www-form-urlencoded content disposition.

2 days of messing around trying to get it to work and this solved it, thanks!

0

PavelPolyakov said:

ok, it looks like in postman you should point that the data you send is 'x-www-url-formurlencoded'

It solved my problems. Thanks. Postman should has a tooltip or a simple introduction to guide us :D

0

EspadaV8 said:

Anyone worked out how to get this working with PUT/PATCH and form-data? I need to submit files along with the request. For now I've fallen back to using a POST with the _method = PUT but would ideally like a nicer way of dealing with this.

You are my 2nd saviour :d I don't know we could cheat POSTMAN by using that trick This is my case :

  • I want to use method PUT to upload file with POSTMAN. But if I point data to x-www-url-formurlencoded, it would not allow me to use File input. So in this case, with POSTMAN, I use POST, but with a _method input equal to PUT. It will allows me to PUT data with file (This trick only works with Laravel)
0

You only must add ?_method=PUT after your URL request (params)

0

Here's a solution: [https://github.com/laravel/framework/issues/13457#issuecomment-341973180]

Last updated 6 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

cesartc cesartc Joined 13 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.