Reputation: 975
I'm studying API's and I'm facing a problem. In web apps we can easially pass an array of ID's, for eg categories ID's to the controller. But when we use API, how do we post this array?
Tipically we have a select input in html.
I've tried a form-data with categories[] and values [0 => 1, 1 => 5] but doesn't work.
Can someone explain this to me? Regards and thanks.
EDIT 1:
Do we need to add N categories[]
field and we need to test as an array?
Upvotes: 2
Views: 2962
Reputation: 2545
yes you need to add N categories[]
in your postman request like so
and in your controller you will receive it as $request()->get('users')
and it will be an array of users
Upvotes: 4