Skip to content
This repository has been archived by the owner on Nov 13, 2018. It is now read-only.

This is an auto-generated client library for Onfido API v2

License

Notifications You must be signed in to change notification settings

eeveebank/api-java-client

 
 

Repository files navigation

onfido-java

Requirements

Building the API client library requires Maven to be installed.

Installation

To install the API client library to your local Maven repository, simply execute:

mvn install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn deploy

Refer to the official documentation for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
    <groupId>com.onfido</groupId>
    <artifactId>onfido-java</artifactId>
    <version>1.4.0</version>
    <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

compile "com.onfido:onfido-java:1.4.0"

Others

At first generate the JAR by executing:

mvn package

Then manually install the following JARs:

  • target/onfido-java-1.4.0.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

import com.onfido.*;
import com.onfido.auth.*;
import com.onfido.models.*;
import com.onfido.api.DefaultApi;

import java.time.LocalDate;
import java.io.File;
import java.util.*;

public class DefaultApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        
        // Configure API key authorization: Token
        ApiKeyAuth Token = (ApiKeyAuth) defaultClient.getAuthentication("Token");
        Token.setApiKey("token=" + "YOUR API KEY");
        Token.setApiKeyPrefix("Token");

        // Limit the at-rest region, if needed (optional, see https://documentation.onfido.com/#regions)
        defaultClient.setRegion("YOUR_REGION");

        DefaultApi apiInstance = new DefaultApi();
        // setting applicant details
        Applicant applicant = new Applicant();
        applicant.setFirstName("John");
        applicant.setLastName("Smith");
        applicant.setDob(LocalDate.parse("1980-01-22"));
        applicant.setCountry("GBR");

        Address address = new Address();
        address.setBuildingNumber("100");
        address.setStreet("Main Street");
        address.setTown("London");
        address.setPostcode("SW4 6EH");
        address.setCountry("GBR");

        List<Address> addresses = new ArrayList<Address>();
        addresses.add(address);
        applicant.setAddresses(addresses);

        // setting check request details
        CheckCreationRequest check = new CheckCreationRequest();
        check.setType("express");

        Report report = new Report();
        report.setName("identity");

        List<Report> reports = new ArrayList<Report>();
        reports.add(report);
        check.setReports(reports);
        try {
            Applicant newApplicant = apiInstance.createApplicant(applicant);
            String applicantId = newApplicant.getId();
            System.out.println("Applicant ID: " + applicantId);
            Check newCheck = apiInstance.createCheck(applicantId, check);
            System.out.println(newCheck);
        } catch (ApiException e) {
            System.err.println("Exception creating an applicant/check");
            System.err.println(e.getResponseBody());
        }
    }
}

Documentation for API Endpoints

All URIs are relative to https://api.onfido.com/v2

Class Method HTTP request Description
DefaultApi cancelReport POST /checks/{check_id}/reports/{report_id}/cancel This endpoint is for cancelling individual paused reports.
DefaultApi createApplicant POST /applicants Create Applicant
DefaultApi createCheck POST /applicants/{applicant_id}/checks Create a check
DefaultApi createWebhook POST /webhooks Create a webhook
DefaultApi destroyApplicant DELETE /applicants/{applicant_id} Delete Applicant
DefaultApi downloadDocument GET /applicants/{applicant_id}/documents/{document_id}/download Download a documents raw data
DefaultApi downloadLivePhoto GET /live_photos/{live_photo_id}/download Download live photo
DefaultApi findAddresses GET /addresses/pick Search for addresses by postcode
DefaultApi findApplicant GET /applicants/{applicant_id} Retrieve Applicant
DefaultApi findCheck GET /applicants/{applicant_id}/checks/{check_id} Retrieve a Check
DefaultApi findDocument GET /applicants/{applicant_id}/documents/{document_id} A single document can be retrieved by calling this endpoint with the document’s unique identifier.
DefaultApi findLivePhoto GET /live_photos/{live_photo_id} Retrieve live photo
DefaultApi findReport GET /checks/{check_id}/reports/{report_id} A single report can be retrieved using this endpoint with the corresponding unique identifier.
DefaultApi findReportTypeGroup GET /report_type_groups/{report_type_group_id} Retrieve single report type group object
DefaultApi findWebhook GET /webhooks/{webhook_id} Retrieve a Webhook
DefaultApi listApplicants GET /applicants List Applicants
DefaultApi listChecks GET /applicants/{applicant_id}/checks Retrieve Checks
DefaultApi listDocuments GET /applicants/{applicant_id}/documents List documents
DefaultApi listLivePhotos GET /live_photos List live photos
DefaultApi listReportTypeGroups GET /report_type_groups Retrieve all report type groups
DefaultApi listReports GET /checks/{check_id}/reports All the reports belonging to a particular check can be listed from this endpoint.
DefaultApi listWebhooks GET /webhooks List webhooks
DefaultApi resumeCheck POST /checks/{check_id}/resume Resume a Check
DefaultApi resumeReport POST /checks/{check_id}/reports/{report_id}/resume This endpoint is for resuming individual paused reports.
DefaultApi updateApplicant PUT /applicants/{applicant_id} Update Applicant
DefaultApi uploadDocument POST /applicants/{applicant_id}/documents Upload a document
DefaultApi uploadLivePhoto POST /live_photos Upload live photo

Documentation for Models

About

This is an auto-generated client library for Onfido API v2

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 99.3%
  • Other 0.7%