Gei insurance details of a patient

http://localhost:8086/apis/default/api/patient/2/insurance/primary I am using this api to get insurance details of a patient but I am getting 500 status code which is internal server error I am using the correct authorization token as well.Please help me out what can be the issue with this?

Hi @Dikshita_Mahajan ,

This issue might be because of the inability of encoding the JSON response for the uuid parameter.
For this, you can make the necessary changes in the code [/openemr7/src/Services/InsuranceService.php] as follows to get the API response.

 public function getOneByPid($id, $type)
 {         
    $sql = "SELECT * FROM insurance_data WHERE pid=? AND type=?";
    $sqlResult = sqlQuery($sql, array($id, $type));
    if ($sqlResult) {
          $sqlResult['uuid'] = UuidRegistry::uuidToString($sqlResult['uuid']);
    }
    return $sqlResult;
  }

Now you are able to get the insurance details of a patient.

If you have any questions or need further assistance, please feel free to contact us at openemr.support@visolve.com .
-ViSolve OpenEMR Team.