We already provided some .NET samples to access the BioID Web Service (BWS) using SOAP requests, e. g. with the BWS command line interface. It's time to give you a sample that uses the RESTful BWS extension to perform BWS tasks.
How does the RESTful BWS Extension API work?
Before you can start using the BWS Extension, you need to have access to a BWS installation of course. If you don't have access to a BWS installation yet, you can register for a free trial instance. As soon as you have your BWS access information available, you can register a BWS client application (in the BWS Portal) to get a BWS App-ID and App-Secret, which are required to call into the BWS Extension.
Please note that all REST API methods use the BWS Extension base URI
(except if you have your own BWS installation where you have to use the host name of your BWS installation of course).
Now, the first thing you have to do for every BWS task you want to perform, is to fetch a BWS Token using the BWS Token Extension.
As the token request requires your BWS App-ID and App-Secret, the token is typically requested by some server-side code. It is not recommended to request a token directly from a client application as long as you cannot ensure that your App-Secret doesn't get compromised!
In the Token Extension documentation you can find a sample of how to request a token for .NET, here is another one using the Windows PowerShell:
You can request a token similar to the one with the sample above at our BWS Extension Test page.
Performing the BWS tasks
In the sample script attached to this post you find a lot of code handling the capturing of video samples, which is not so interesting in the context of this post. The more interesting part is, what happens as soon as we have found an image that we want to upload to the BWS for face recognition tasks, and finally, what happens as soon as we uploaded enough images, so we can finally perform the biometric operation. Please note that the BWS Extension currently only supports training and verification of the face trait.
Both tasks, upload and biometric operation are performed by simple Ajax calls which both use a BWS token that previously has been created and provided to the script from outside. You can find the calls in the attached script in the methods
performTask(). The upload looks something like this (for simplicity the code has been shortened):
The corresponding function that performs the biometric operation looks something like this (again shortened a little bit):
How to use the attached script
Although the script is intended to be used with the BWS unified user interface, feel free to also use it (with or without modifications) on your web site. The usage is very simple:
Assuming you have at least the following HTML elements on your web page
you can start with a jQuery script as follows: