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"
}
2
Answers
I see your code. The code looks fine but in my thinking problem could be at multiple parts of the HTTP request.
Based on your response to my question:
I would expect this behaviour. You’re using
dd();
which is Laravelsdump and die
method. What this does isdump
the data you provide it and thendie
which halts execution meaning nothing after thedd()
is ever executed.So your
return
statement is never executed, hence no response.