'HttpErrorResponse "Http failure response for http://localhost:8443/gestion-centros-api/workCenters/vehicles: 500 OK"

I'm unable to retrieve the list of vehicles from the api. That was the error showed. I need help.

Below is my code

Logic from the service

  getAllVehicle(): Observable<Vehicles[]> {
return this.http.get<Vehicles[]>( this.getApiBaseUrl() + '/workCenters/vehicles');

}

Logic from vehicle.ts

getAllVehicles() {
this.vehicles = [];
this.workCenterFilterService.getAllVehicle().subscribe(
  response => {
  console.log(response);
    this.vehicles = response;
}, error1 => {
  console.log(error1);

});

}



Solution 1:[1]

You could debug your API http://localhost:8443/gestion-centros-api/workCenters/vehicles with Postman. -> https://www.postman.com/

Error 500 always means, that something went wrong on the Server and you have to look in the logs to find out the issue.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 AndyNope