This Data-Fornix-Web API SDK provides a set of method's for JavaScript applications to verify user, capture and save data.
In order to start integration, you will need the API token.
Include it as a regular script tag on your page:
<script src='dist/data-fornix-web-api.js'></script>
You can also import it as a module into your own JS build system (tested with Webpack).
$ npm install --save data-fornix-web-api
// ES6 module import
import DataFornixApi from 'data-fornix-web-api'
// commonjs style require
var DataFornixApi = require('data-fornix-web-api')
You are now ready to initialize the SDK:
// Create instance of DataFornix Web API SDK
// and store it in `dataFornixAPIInstance` for future use
const dataFornixAPIInstance = new DataFornixApi({
apiToken: <Your API TOKEN HERE>,
baseUrl: <Your Server Base Url>
});
To verify that SDK is successfully initialized or not, you can pass callback function as second parameter
const dataFornixAPIInstance = new DataFornixApi(
{
apiToken: <Your API TOKEN HERE>,
baseUrl: <Your Server Base Url>
},
function (response) {
console.log('api sdk ready to use', response);
}
);
You also need to create user after SDK initialize and before any other sdk method call.
Call createUser
method
// dummy user object
const userData = {
"email":"VALID_USER",
"name":"USER_NAME",
"phone_number":"USER_PHONE",
"country_code":"USER_COUNTRY_CODE"
}
const createUserRes = dataFornixAPIInstance.createUser(userData);
// Return promise object
createUserRes.then(function (success) {
// call SDK other methods here
console.log('Call SDK other methods here')
}, function (error) {
console.log('Error in create use => ', error);
});
Following parameters are using to initialize API SDK:
-
apiToken {String} required
A API Token is required in order to authorise. If one isn’t present, an exception will be thrown.
-
callback {Function} optional
Callback function that fires when the Api SDk successfully initialized.
Method | Description |
---|---|
createUser | This method is for get user details from database before other api call. |
createUserToken | This method is for generate unique token for user and return saved details from database. |
documentDataCapture | This method is for capture data from provided documents. |
documentDataSave | This method is for save captured document into database. |
checkVideo | Responsiable for store and verify user video. |
SelfieVerify | Responsiable for store and verify user selfie image. |
getAssets | This method is responsiable for send all assets list. |
deleteAsset | This method is responsiable for delete asset. |
getSharedAssets | This method is responsiable for send all user shared assets list. |
organisationAssetRequest | Responsiable for send list of organisation request for assets. |
organisationAllAssetRequest | Responsiable for send list of organisation request for all assets. |
updateAssetDetails | Responsiable for update asset data and store. |
uploadAssetRequest | Responsiable for send list of upload asset request. |
generateSelfieToken | Responsiable for get selfie token. |
selfieVerifyWithToken | Responsiable for send selfie using unique token. |
getSelfieResult | Responsiable for get selfie match status with other asset. |