Good day
I will like to get customers credit details in my app after inputer the required parameters through the
form input. After inputing the required values in the form fields and clicking the submit button the
response was json with key but null value.
My Code
// Collection object
$data = [
'BVN' => $_POST["customerBVN2"],
'SessionCode' => $_POST["sessionCode2"],
];
// Credit Registry API url
$url = "https://api2.creditregistry.com/nigeria/AutoCred/v7.Test/api/Reports/GetData2";
// Initializes a new cURL session
$curl = curl_init($url);
// Set the CURLOPT_RETURNTRANSFER option to true
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// Set the CURLOPT_POST option to true for POST request
curl_setopt($curl, CURLOPT_POST, true);
// Set the request data as JSON using json_encode function
curl_setopt($curl, CURLOPT_POSTFIELDS, json_encode($data));
// Set custom headers for RapidAPI Auth and Content-Type header
curl_setopt($curl, CURLOPT_HTTPHEADER, [
'Content-Type: application/json'
]);
// Execute cURL request with all previous settings
$response = curl_exec($curl);
// Close cURL session
curl_close($curl);
echo $response . PHP_EOL;
Error response
{"Success":false,"Errors":["Invalid request. ReportDataRequest property of the GetDataRequest2 object cannot be null. Expected object format is: \r\n {\r\n \"SessionCode\": \"\",\r\n \"ReportDataRequest\": {\r\n \"BVN\": \"\",\r\n \"AccountOwnerIDs\": \"\",\r\n \"HistoryLengthInMonths\": 84,\r\n \"SectorExclusionIDs\": \"\",\r\n \"IncludeSMARTScore\": false,\r\n \"IncludePDFReport\": false,\r\n \"PDFReportType\": 110,\r\n \"Reason\": \"General credit inquiry\",\r\n \"GetNoMatchReport\": 0\r\n }\r\n}"],"SMARTScores":[],"Accounts":[],"PerformanceSummary":{"Inquiry_Count_12_Months":null,"Count_AccountStatus_Closed":null,"Count_AccountStatus_Delinquent_30_over_60_days":null,"Count_AccountStatus_Derogatory_120_days":null,"Count_AccountStatus_Derogatory_150_days":null,"Count_AccountStatus_Derogatory_Doubtful_180":null,"Count_AccountStatus_Derogatory_Lost_360":null,"Count_AccountStatus_Derogatory_Substandard_90":null,"Count_AccountStatus_Late_less_than_30_days":null,"Count_AccountStatus_Open":null,"Count_AccountStatus_Performing":null,"Count_AccountStatus_Unknown":null,"Count_AccountStatus_Unspecified":null,"Count_AccountStatus_Written_off":null,"Count_LegalStatus_Judgment":null,"Count_LegalStatus_Litigation":null,"Count_LegalStatus_Notice":null,"Count_LegalStatus_Receivership":null,"SelfInquiriesLast12Months":null,"DishonouredChequesLast12Months":null},"AccountSummaries":[],"PDFReport":{"Success":true,"Errors":[],"PDFContent":"","NoMatchPDFContent":"","ReportNo":"","Filename":"","StatusCode":200,"Message":""},"StatusCode":400,"Message":"Invalid request. ReportDataRequest property of the GetDataRequest2 object cannot be null."}
Kindly help