The job status endpoint lets you retrieve information about jobs you have ran previously. With the job status endpoint, you can get the job results, submitted selfie and liveness images, and the ID response (this is only available on the Enhanced KYC and Biometric KYC products).
If you are querying job status for a job immediately after submitting it, you might need to keep polling job status till you get a result. We recommend you always submit your job with a callback.
To run job status for a job, you can edit the sample code below:
importsmile.identity.core.Utilities;importsmile.identity.core.models.Options;importsmile.identity.core.models.JobStatusResponse;// InitializeString partnerId ="<Put your partner ID here>"; // login to the Smile ID portal to view your partner idString apiKey ="<Put your API key here>"; // copy your API key from the Smile ID portalString sidServer ="<0 | 1>"; // Use '0' for the sandbox server, use '1' for production serverUtilities utilities =newUtilities();// Set options for the job statusboolean returnJobStatus =false; // set to true if you want to get the job result in syncboolean returnHistory =false; // Set to true to return results of all jobs you have ran for the user in addition to current job result. You must set return_job_status to true to use this flag.boolean returnImageLinks =false; // Set to true to receive selfie and liveness images you uploaded. You must set return_job_status to true to use this flag.String callbackUrl ="< optional callback url to use for this job only >";Options options =newOptions(returnHistory, returnImageLinks, returnJobStatus, callBackUrl);// Get the job statusString userId ="<put the user_id of the user whose job(s) results you want to retrieve>"; String jobId ="<put the job_id of the job you want to retrieve its results>";JobStatusResponse response =utilities.getJobStatus(userId, jobId, options);
You can also poll for a job status using:
int retryCount =3; // number of retry attempts, default is 3long initialDelay =2000L; // how long between each try to wait for exponitial backoff, default 2000ms.JobStatusResponse response =pollJobStatus(userId, jobId, options, retryCount, initialDelay);