I am getting null response in laravel after dd(); ,however in Postman i am getting a response, maybe I am passing the wrong body to the API, kindly guide me on how to pass the following body to this API.
Thanks for your help.
This is my controller
public function callpdf(Request $req) { // code... $host = new HostClass(); $obj = new SessionClass(); $response8 = Http::POST($host->getserverIp() . '/PDFReport',[ // "patientId"=> $obj->getpatientId(), "patientId"=>"001000010818", "reportId"=> "618", "con"=>"003001200326197", "departmentId"=> "128", "orderStatusId" => "12", "organizationId"=>"332", "sessionId"=> "3", ]); dd($response8); return $response8; }
This is Postman request and response
{ "patientId": "001000010818", "departmentId": "128", "con": "003001200326197", "odi": "2", "orderStatusId" : "12", "reportId": "618", "organizationId":"332", "sessionId": "3" }
Advertisement
Answer
I am getting null response in laravel after dd();, however in Postman i am getting a response
Based on your response to my question:
Is your callPdf method a web or api route? When using Postman, are you calling the API directly?
@Peppermintology it’s a web route, API is “PDFReport”
I would expect this behaviour. You’re using dd();
which is Laravels dump and die
method. What this does is dump
the data you provide it and then die
which halts execution meaning nothing after the dd()
is ever executed.
So your return
statement is never executed, hence no response.