env('SHIPPPING_APP_URL'), 'headers' => [ 'Authorization' => 'Bearer ' . env('SHIPPING_API_KEY'), 'Accept' => 'application/json', ], // Optionally set a timeout 'timeout' => 10, ]); // Prepare query parameters $query = [ 'user_id' => 5 // 'user_id' => $request->user()->id, ]; // Send GET request to /api/batchListWMS with user_id as query parameter $response = $client->request('GET', '/api/batchListWMS', [ 'query' => $query, ]); $batches = json_decode($response->getBody()->getContents(), true); // Return decoded JSON (or raw body, depending on your needs) return response()->json([ "batches" => $batches['batches'], ]); // return json_decode($response->getBody()->getContents(), true); } public function expediceListWMS(Request $request) { // Instantiate Guzzle client $client = new Client([ 'base_uri' => env('SHIPPPING_APP_URL'), 'headers' => [ 'Authorization' => 'Bearer ' . env('SHIPPING_API_KEY'), 'Accept' => 'application/json', ], // Optionally set a timeout 'timeout' => 40, ]); // Prepare payload $payload = [ 'batch_id' => $request->input('batch_id'), // or wherever you pull batch_id from ]; // Send POST request with JSON body $response = $client->request('POST', '/api/warehouseExpediceListWMS', [ 'json' => $payload, ]); $batch_items = json_decode($response->getBody()->getContents(), true); // Return decoded JSON (or raw body, depending on your needs) return response()->json([ "batch_items" => $batch_items, ]); // return json_decode($response->getBody()->getContents(), true); } public function getProductImage(Request $request) { // Instantiate Guzzle client $client = new Client([ 'base_uri' => env('SHIPPPING_APP_URL'), 'headers' => [ 'Authorization' => 'Bearer ' . env('SHIPPING_API_KEY'), 'Accept' => 'application/json', ], // Optionally set a timeout 'timeout' => 40, ]); // Prepare query parameters instead of JSON body $query = [ 'selectedShipmentID' => $request->input('selectedShipmentID'), ]; // Send GET request with query parameters $response = $client->request('GET', '/api/warehouseExpedice/getImage', [ 'query' => $query, ]); $batch_items = json_decode($response->getBody()->getContents(), true); // Return decoded JSON (or raw body, depending on your needs) return response()->json($batch_items); // return json_decode($response->getBody()->getContents(), true); } }