**Need to return laravel validation response which is come from Post API
Using Laravel 5.2 making request from a form**
Controller Code:-
public function aperi(Request $request){
$endpoint = "MyURL";
$client = new \GuzzleHttp\Client();
$name = $request->addavpname;
$email = $request->addavpemail;
$status = $request->addStatus;
$response = $client->request('POST', $endpoint, ['query' => [
'addavpname' => $name,
'addavpemail' => $email,
'addStatus' => $status
]]);
$statusCode = $response->getStatusCode();
$content = $response->getBody();
$content = json_decode($response->getBody(), true);
}
Response from server:-
Client error: `POST "MY URL"
addavpname=No%20avp&addavpemail=noavp%40mobilelinkusa.com&addStatus=active`
resulted in a `400 Bad Request` response:
{"addavpname":["The addavpname has already been taken."],"addavpemail":
["The addavpemail has already been taken."]}
Kindly help me. How to solve it?Thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire