For this demonstration, the Python programming language will be used, but there are several other examples in our API documentation.

After obtaining your subscription key, the next step will be to do your first request to the API, inserting the key in the HTTP request header (<API-KEY>). This key will be used to authenticate your user account and, thus, proceed with requests to the BioPass ID.

To do a request, besides the subscription key, you’ll need to know the URL of the functionality you want to use and understand the parameters that must be passed for said functionality in a JSON file. To learn the operations and its parameters, access our API documentation

As an example, if you wish to register a user in your application, type code below, as shown in our documentation:

import http.client
import json

conn = http.client.HTTPSConnection("hml-api.biopassid.com")
payload = json.dumps({
  "Person": {
    "CustomID": "1234",
    "Face": [
      {
        "Face-1": "/9j/4AAQSkZJRgABAQAAA..."
      }
    ]
  }
})
headers = {
  'Content-Type': 'application/json',
  'Ocp-Apim-Subscription-Key': '<API-KEY>'
}
conn.request("POST", "/multibiometrics/enroll", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))

Note that the URL field is filled according to the request one wishes to make. Also, the data being passed is a CustomID object, which is a string used to identify the user, and, therefore, must be unique (a recommendation would be to use a user’s identifying document for this registration), and a Face, an array of strings of base64 of the user’s face’s image. Lastly, there is also, in the header, a field in which your subscription key must be inserted. 

At the end, the code block above creates a variable response, which receives the response of the request made to BioPassID, which will vary according to each method.

In case an error is returned, make sure that the text in JSON format was written correctly. An example would be the error 400, invalid JSON format, which can be returned when any of the variables are not filled correctly, if there is a missing comma or any other mandatory punctuation in the code, or when the basic requirements of data to be passed are not met (for example, the enroll method requires at least one face or fingerprint image).

Another example is the error 401, Unauthorized, which usually means that your subscription key was not inserted properly into the code. If this error is returned, make sure your subscription key was typed in correctly.

In case you receive the response code 200 (OK), this means your request was successful and, therefore, you can proceed with your next requests. Below you can see the system response to the request made in the example:

{
    "Person": {
        "ClientID": "1628692218558x176807293303153250",
        "CustomID": "1234",
        "BioPassID": "1648"
    }
}

In this response, it is possible to check the CustomID code number that was used to register the image template. It is important to emphasize that we do not keep the image that was sent to us, only the template that is used to identify the user, discarding the image as soon as the template is generated.