Interactions with the Oz API Server

Retrofit API

SDK contains IOzForensicsAPI interface describing APO net calls that can be used to create a Retrofit instance.

This interface uses a gson-converter and operates classes from the com.ozforensics.liveness.sdk.api.model pack.

Apart from this, the interface specifies a static method for creating a default Retrofit instance (without logging, interceptors and with 15-second timeouts). This instance will look for the server at the specified address:

val apiService = OzForensicsAPI.create(BASE_URL)

OzForensicsService Class

SDK includes the OzForensicsService class that uses a Retrofit instance from OzForensicsAPI.create(). This class wraps in net calls from the Retrofit interface and checks the presence of a token. When an auth request is performed, the token is stored automatically for internal goals. Also, the required metadata is added where necessary when performing the net requests (creating a folder, uploading media data to be analyzed). The method calls of this class are asynchronous (the StatusListener<> interface is used). You can obtain an instance of this class as follows:

val service = OzForensicsService(BASE_URL, ACCESS_TOKEN)

If the TOKEN parameter value is set to null, authorization is required before performing any API call (except auth):

service.auth(EMAIL, PASSWORD, listener)

After a successful request, onSuccessCallback is performed so that the access token can be transferred with AuthResponse.

Last updated