Java

Installation

View the package on Maven and the open source code on Github.

Add the group, name and version to your application's build file, it will look similar based on your build tool:

group: "com.smileidentity", name: "smile-identity-core", version: ""and require the package:

The following classes exist for use:

import smile.identity.core.PartnerParameters;
import smile.identity.core.ImageParameters;
import smile.identity.core.IDParameters;
import smile.identity.core.Options;
import smile.identity.core.WebApi;
import smile.identity.core.IDApi;

submit_job method

Copy this code and replace sections marked with <>

try {
PartnerParameters partnerParameters = new PartnerParameters(new PartnerParameters(<String user_id>, <String job_id>, <Integer job_type>);
partnerParameters.add("optional_info", "some optional info");
// Note dob is only required for PASSPORT, VOTER_ID, DRIVERS_LICENSE, NATIONAL_ID, TIN, and CAC. For the rest of the id types you can send through dob as null or empty.
IDParameters idInfo = new IDParameters(<String firstName>, <String middleName>, <String lastName>, <String country>, <String idType>, <String idNumber>, <String dob>, <String phoneNumber>, <String entered>);
ImageParameters imageParameters = new ImageParameters();
imageParameters.add(<Integer imageTypeId>, <String downloadPath or base64>);
Options options = new Options(<String optionalCallback>, <String returnJobStatus>, <String returnHistory>, <String returnImages>);
WebApi connection = new WebApi(<String partnerId>, <String callback>, <String the decoded-version of-your-api-key>, <Integer sidServer>);
String response = connection.submit_job(partnerParameters.get(), imageParameters.get(), idInfo.get(), options.get());
System.out.println("\n Response" + response);
} catch (Exception e) {
e.printStackTrace();
throw e;
}

Response:

Should you choose to set return_job_status to false, the response will be a JSON String containing:

{success: true, smile_job_id: smile_job_id}

However, if you have set return_job_status to true (with image_links and history) then you will receive JSON Object response like below:

{
"job_success":true,
"result":{
"ConfidenceValue":"99",
"JSONVersion":"1.0.0",
"Actions":{
"Verify_ID_Number":"Verified",
"Return_Personal_Info":"Returned",
"Human_Review_Update_Selfie":"Not Applicable",
"Human_Review_Compare":"Not Applicable",
"Update_Registered_Selfie_On_File":"Not Applicable",
"Liveness_Check":"Not Applicable",
"Register_Selfie":"Approved",
"Human_Review_Liveness_Check":"Not Applicable",
"Selfie_To_ID_Authority_Compare":"Completed",
"Selfie_To_ID_Card_Compare":"Not Applicable",
"Selfie_To_Registered_Selfie_Compare":"Not Applicable"
},
"ResultText":"Enroll User",
"IsFinalResult":"true",
"IsMachineResult":"true",
"ResultType":"SAIA",
"PartnerParams":{
"job_type":"1",
"optional_info":"we are one",
"user_id":"HBBBBBBH57g",
"job_id":"HBBBBBBHg"
},
"Source":"WebAPI",
"ResultCode":"0810",
"SmileJobID":"0000001111"
},
"code":"2302",
"job_complete":true,
"signature":"HKBhxcv+1qaLy\C7PjVtk257dE=|1577b051a4313ed5e3e4d29893a66f966e31af0a2d2f6bec2a7f2e00f2701259",
"history":[
{
"ConfidenceValue":"99",
"JSONVersion":"1.0.0",
"Actions":{
"Verify_ID_Number":"Verified",
"Return_Personal_Info":"Returned",
"Human_Review_Update_Selfie":"Not Applicable",
"Human_Review_Compare":"Not Applicable",
"Update_Registered_Selfie_On_File":"Not Applicable",
"Liveness_Check":"Not Applicable",
"Register_Selfie":"Approved",
"Human_Review_Liveness_Check":"Not Applicable",
"Selfie_To_ID_Authority_Compare":"Completed",
"Selfie_To_ID_Card_Compare":"Not Applicable",
"Selfie_To_Registered_Selfie_Compare":"Not Applicable"
},
"ResultText":"Enroll User",
"IsFinalResult":"true",
"IsMachineResult":"true",
"ResultType":"SAIA",
"PartnerParams":{
"job_type":"1",
"optional_info":"we are one",
"user_id":"HBBBBBBH57g",
"job_id":"HBBBBBBHg"
},
"Source":"WebAPI",
"ResultCode":"0810",
"SmileJobID":"0000001111"
}
],
"image_links":{
"selfie_image":"image_link"
},
"timestamp":"2019-10-10T12:32:04.622Z"
}

You can also view your response asynchronously at the callback that you have set, it will look as follows:

{
"job_success":true,
"result":{
"ConfidenceValue":"99",
"JSONVersion":"1.0.0",
"Actions":{
"Verify_ID_Number":"Verified",
"Return_Personal_Info":"Returned",
"Human_Review_Update_Selfie":"Not Applicable",
"Human_Review_Compare":"Not Applicable",
"Update_Registered_Selfie_On_File":"Not Applicable",
"Liveness_Check":"Not Applicable",
"Register_Selfie":"Approved",
"Human_Review_Liveness_Check":"Not Applicable",
"Selfie_To_ID_Authority_Compare":"Completed",
"Selfie_To_ID_Card_Compare":"Not Applicable",
"Selfie_To_Registered_Selfie_Compare":"Not Applicable"
},
"ResultText":"Enroll User",
"IsFinalResult":"true",
"IsMachineResult":"true",
"ResultType":"SAIA",
"PartnerParams":{
"job_type":"1",
"optional_info":"we are one",
"user_id":"HBBBBBBH57g",
"job_id":"HBBBBBBHg"
},
"Source":"WebAPI",
"ResultCode":"0810",
"SmileJobID":"0000001111"
},
"code":"2302",
"job_complete":true,
"signature":"HKBhxcv+1qaLy\C7PjVtk257dE=|1577b051a4313ed5e3e4d29893a66f966e31af0a2d2f6bec2a7f2e00f2701259",
"history":[
{
"ConfidenceValue":"99",
"JSONVersion":"1.0.0",
"Actions":{
"Verify_ID_Number":"Verified",
"Return_Personal_Info":"Returned",
"Human_Review_Update_Selfie":"Not Applicable",
"Human_Review_Compare":"Not Applicable",
"Update_Registered_Selfie_On_File":"Not Applicable",
"Liveness_Check":"Not Applicable",
"Register_Selfie":"Approved",
"Human_Review_Liveness_Check":"Not Applicable",
"Selfie_To_ID_Authority_Compare":"Completed",
"Selfie_To_ID_Card_Compare":"Not Applicable",
"Selfie_To_Registered_Selfie_Compare":"Not Applicable"
},
"ResultText":"Enroll User",
"IsFinalResult":"true",
"IsMachineResult":"true",
"ResultType":"SAIA",
"PartnerParams":{
"job_type":"1",
"optional_info":"we are one",
"user_id":"HBBBBBBH57g",
"job_id":"HBBBBBBHg"
},
"Source":"WebAPI",
"ResultCode":"0810",
"SmileJobID":"0000001111"
}
],
"image_links":{
"selfie_image":"image_link"
},
"timestamp":"2019-10-10T12:32:04.622Z"
}

If you have queried a job type 5, your response be a JSON String that will contain the following:

{
"JSONVersion":"1.0.0",
"SmileJobID":"0000001105",
"PartnerParams":{
"user_id":"T6yzdOezucdsPrY0QG9LYNDGOrC",
"job_id":"FS1kd1dd15JUpd87gTBDapvFxv0",
"job_type":5
},
"ResultType":"ID Verification",
"ResultText":"ID Number Validated",
"ResultCode":"1012",
"IsFinalResult":"true",
"Actions":{
"Verify_ID_Number":"Verified",
"Return_Personal_Info":"Returned"
},
"Country":"NG",
"IDType":"PASSPORT",
"IDNumber":"A04150107",
"ExpirationDate":"2017-10-28",
"FullName":"ADEYEMI KEHINDE ADUNOLA",
"DOB":"1989-09-20",
"Photo":"SomeBase64Image",
"sec_key":"pjxsxEY69zEHjSPFvPEQTqu17vpZbw+zTNqaFxRWpYDiO+7wzKc9zvPU2lRGiKg7rff6nGPBvQ6rA7/wYkcLrlD2SuR2Q8hOcDFgni3PJHutij7j6ThRdpTwJRO2GjLXN5HHDB52NjAvKPyclSDANHrG1qb/tloO7x4bFJ7tKYE=|8faebe00b317654548f8b739dc631431b67d2d4e6ab65c6d53539aaad1600ac7",
"timestamp":1570698930193
}

get_job_status method

Sometimes, you may want to get a particular job status at a later time. You may use the get_job_status function to do this:

You will already have your Web Api class initialised as follows:

WebApi connection = new WebApi(<String partner_id>, <String default_callback_url>, <String decoded_version_of_api_key>, <Integer 0 || 1>);

Thereafter, simply call get_job_status with the correct parameters using the classes we have provided:

// create the stringified json for the partner params using our class (i.e. user_id, job_id, and job_type that you would are querying)
PartnerParameters partnerParameters = new PartnerParameters(<String user_id>, <String job_id>, <Integer job_type>);
// create the options - whether you would like to return_history and return_image_links in the job status response
Options job_status_options = new Options(<Boolean return_history>, <Boolean return_image_links>);
response = connection.get_job_status(partnerParameters.get(), job_status_options.get());

Please note that if you do not need to pass through Options if you will not be using them, you may omit calling those class and send through null instead:

String response = connection.get_job_status(partnerParameters.get(), null);

Signature Class

To calculate your signature first import the necessary class:

import smile.identity.core.Signature;

generate_sec_key method

Then call the Signature class as follows:

import smile.identity.core.Signature;
try {
Signature connection = new Signature(partner_id, api_key);
String signatureJsonStr = connection.generate_sec_key(timestamp); // where timestamp is optional
// In order to utilise the signature you can then use a json parser and extract the signature
} catch (Exception e) {
e.printStackTrace();
throw e;
}

The response will be a stringified json object:

{
sec_key: "<the generated sec key>",
timestamp: "<timestamp that you passed in or that was generated>"
}

confirm_sec_key method

You can also confirm the signature that you receive when you interacting with our servers, simply use the confirm_sec_key method which returns a boolean:

import smile.identity.core.Signature;
try {
Signature connection = new Signature(partner_id, api_key);
String signatureJsonStr = connection.confirm_sec_key(sec_key, timestamp);
// If it is valid then use the response, else throw an error
} catch (Exception e) {
e.printStackTrace();
throw e;
}

Utilities Class

You may want to receive more information about a job. This is built into Web Api if you choose to set return_job_status as true in the options class. However, you also have the option to build the functionality yourself by using the Utilities class. Please note that if you are querying a job immediately after submitting it, you will need to poll it for the duration of the job.

import smile.identity.core.Utilities;
String job_status = new Utilities(<partner_id>, <the decoded-version of-your-api-key>, <sid_server>).get_job_status(<user_id>, <job_id>, <return_image_links> , <return_history>);
System.out.println(job_status);

This returns the job status as stringified json data.

get_job_status method

Sometimes, you may want to get a particular job status at a later time. You may use the get_job_status function to do this:

You will already have your Web Api class initialised as follows:

connection = SmileIdentityCore::WebApi.new(partner_id, default_callback, api_key, sid_server)

Thereafter, simply call get_job_status with the correct parameters:

response = connection.get_job_status(partner_params, options)
where options is {return_history: true | false, return_image_links: true | false}

Please note that if you do not need to pass through options if you will not be using them, you may omit pass through an empty hash or nil instead:

response = connection.get_job_status(partner_params, nil);

Signature Class

generate_sec_key method

$ connection = SmileIdentityCore::Signature.new(partner_id, api_key)
$ sec_key = connection.generate_sec_key(timestamp)
where timestamp is optional

The response will be a hash:

{
:sec_key=> "<the generated sec key>",
:timestamp=> 1563283420
}

confirm_sec_key method

You can also confirm the signature that you receive when you interacting with our servers, simply use the confirm_sec_key method which returns a boolean:

$ connection = SmileIdentityCore::Signature.new(partner_id, api_key)
$ sec_key = connection.confirm_sec_key(sec_key, timestamp)

Utilities Class

You may want to receive more information about a job. This is built into Web Api if you choose to set return_job_status as true in the options hash. However, you also have the option to build the functionality yourself by using the Utilities class. Please note that if you are querying a job immediately after submitting it, you will need to poll it for the duration of the job.

utilities_connection = SmileIdentityCore::Utilities.new('partner_id', 'api_key' , sid_server)
utilities_connection.get_job_status('user_id', 'job_id', options)
where options is {return_history: true | false, return_image_links: true | false}