Get IDV Databases

API: getIDVDatabaseID

📌 Overview

The getIDVDatabaseID API retrieves available document database configurations from the REL-ID backend. The response includes a list of supported database IDs and their descriptions, which can be shown in a UI dropdown to allow users to select one.

This API needs to be consumed before the document scan initialization in case the useDefaultDatabase is set to false from GM or setIDVConfig. This API will provide the list of available database IDs, and the application needs to set the preferable databaseID using the setIDVDatabaseID API.


🧑‍💻 Method Signature

PlatformSignature
React NativeRdnaClient.getIDVDatabaseID((response) => {});
Flutterrdna.getIDVDatabaseID();
Cordovacom.uniken.rdnaplugin.RdnaClient.getIDVDatabaseID(successCallback, errorCallback);
Native AndroidString getIDVDatabaseID();
Native iOS(NSString *)getIDVDatabaseID;

📤 Response Format

{
  "error": {
    "longErrorCode": 0,
    "shortErrorCode": 0,
    "errorString": "Success"
  },
  "response": {
    "selectedDatabaseId": "India",
    "databaseDetail": [
      { "id": "India", "description": "India", "status": 0 },
      { "id": "Jordan", "description": "Jordan", "status": 0 },
      { "id": "FullDB", "description": "FullDB", "status": 0 }
    ]
  }
}

📑 Field Description

FieldDescription
idUnique ID of the database
descriptionHuman-readable description (e.g., country or region)
statusStatus code (0 = available)

🧪 Sample Code

React Native
RdnaClient.getIDVDatabaseID((result) => {
  if (result.error.shortErrorCode === 0) {
    console.log("Available DBs:", result.response.databaseDetail);
  } else {
    console.error("Failed:", result.error.errorString);
  }
});
Flutter
rdna.getIDVDatabaseID().then((result) {
  if (result["error"]["shortErrorCode"] == 0) {
    print("Databases: ${result["response"]["databaseDetail"]}");
  } else {
    print("Error: ${result["error"]["errorString"]}");
  }
});
Cordova
com.uniken.rdnaplugin.RdnaClient.getIDVDatabaseID(
  function(response) {
    console.log("Response:", response);
  },
  function(error) {
    console.error("Error:", error);
  }
);
Native Android
String result = rdnaClient.getIDVDatabaseID();
JSONObject json = new JSONObject(result);
JSONArray dbList = json.getJSONObject("response").getJSONArray("databaseDetail");
for (int i = 0; i < dbList.length(); i++) {
  JSONObject db = dbList.getJSONObject(i);
  Log.d("DB Option", db.getString("id") + ": " + db.getString("description"));
}
Native iOS
NSString *result = [self.rdnaClient getIDVDatabaseID];
NSData *data = [result dataUsingEncoding:NSUTF8StringEncoding];
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil];
NSArray *dbList = json[@"response"][@"databaseDetail"];
for (NSDictionary *db in dbList) {
  NSLog(@"%@ - %@", db[@"id"], db[@"description"]);
}