Bridge Platform API Code Example
/*********************************************************
* This is sample code For Bridge Platform API usage
********************************************************/
<?php
//Initialize config variables
$username = '< provide username >';
$password = '< provide password >';
$timestamp = date("YmdHis");
$nonsense = "ABCDEFGH";
//Generate Signature
$hashData = $password . '|' . $timestamp . '|' . $nonsense;
$secureHash = strtoupper(hash('sha512', $hashData));
//Prepare HTTP Headers
$arrHeaders = array('username:' . $username, 'Content-
Type:application/json', 'signature:' . $secureHash, 'nonsense:' . $nonsense, 'ti
mestamp:' . $timestamp);
//POST Url
$url = 'https://authbridge.info/client_api_demo/AuthApi/post_data';
//Prepare HTTP POST data
$caseDetails = array();
$caseDetails["uniqueID"] = "AK99"; //should be unique
$caseDetails["firstName"] = "Anil";
$caseDetails["lastName"] = "Kumar";
$caseDetails["fatherName"] = "Rajveer Singh";
$caseDetails["contactNumber"] = "8800247317";
$caseDetails["DOB"] = "1993-01-05";
$caseDetails["locationID"] = "192840";
$caseDetails["processID"] = "885";
$caseDetails["checks"] = array(
array(
"checkUID" => 1,
"type" => 45,
"sourceVerification" => "Pan Verification",
"checkFields" => array(
"1438" => "EEXPK0307H",
"1580" => "Anil Kumar",
"1581" => "1993-01-05"
)
),
array(
"checkUID" => 2,
"type" => 101,
"sourceVerification" => "Driving License Verification",
"checkFields" => array(
"1578" => "Anil Kumar",
"1579" => "DL0720100041164"
)
)
);
//Convert array to Json
$caseDetailsJson = json_encode($caseDetails);
//Initiate curl and call the api with headers and post data
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $arrHeaders);
curl_setopt($ch, CURLOPT_POSTFIELDS, $caseDetailsJson);
$data = curl_exec($ch);
curl_close($ch);
//Get Response in json format
echo $data;
?>
*****************************************************************************
RESPONES DETAILS:
*****************************************************************************
Success Response:
{"status":"success","code":"200","uniqueId":"AK9954647","requestId":"4466","m
sg":"Data Uploaded
Successfully","instantResponse":{"status":"success","code":"200","response":{
"checks":[{"checkUID":"1","type":"45","severity":"Clear","disposition":"The
PAN Number provided matched with the records and was in the subjects
name","status":"Completed","comments":"Exact match found"}]}}}
Failed Response:
{"status":"error","code":"400","msg":"Duplicate unique_id AK99 with
request_id 4465"}