Search code examples
phplaravelapipostmanlaravel-api

How to send parameter with API in get method


I have to run an API on postmen, the project is based upon Laravel. The endpoint is mention below

`Route::get('order/detail/{order}', 'OrdersController@show');`

here is my order controller function:

public function show(Order $order)  
{   
    dd("ok");
}

I am trying to run API using postmen and receiving 404 error enter image description here

but when I removed {order} from endpoints, it worked. so my question is how can I run this API on postmen. Any help would be highly appreciable.


Solution

  • With Route::get('order/detail/{order}', 'OrdersController@show');

    You must use the endpoint is http://localhost:8082/v3/order/detail/45487.

    Not ...order/detail?order=45487

    then

    public function show($order)  //$order is 45487
    {   
        dd("ok");
    }