Get Process
This article explains how to get the result of a process on the platform using the GetProcess
method through the REST API.
Important
**Update on the return of the IDUnico and IDCheck(IDUnico + Check) flows.
The return of the result for all processes with the IDUnico and IDCheck flow has been updated, generalizing the result with the other flows.
When the IDUnico process ends with the result inconclusive or liveness failure, we return the result PROCESS_RESULT_INVALID_IDENTITY
.
Example of the old return of the process result when the user was authenticated:
{
"process": {
...
// Current status of the process.
"state": "PROCESS_STATE_FINISHED",
// Current result of the process.
"result": "PROCESS_RESULT_OK",
...
}
}
Example of the old return of the process result when authentication was inconclusive or liveness failure:
{
"process": {
...
// Process status
"state": "PROCESS_STATE_FINISHED",
// Process result.
"result": "PROCESS_RESULT_INVALID_IDENTITY",
...
}
}
When the process ends with successful liveness and inconclusive of the IDUnico, we will return the result PROCESS_RESULT_OK
and include AUTHENTICATION_RESULT_INCONCLUSIVE
in the authenticationResult
field of authenticationInfo
.
Example of the new return of the process result when the user is AUTHENTICATED:
{
"process": {
...
// Current status of the process.
"state": "PROCESS_STATE_FINISHED",
// Current result of the process.
"result": "PROCESS_RESULT_OK",
// Results of the authentication step.
"authenticationInfo": {
// Process authentication id.
"authenticationId": "cf9e618e-e7a4-4340-b745-b228383c927f",
// Result of authentication with the ID.
"authenticationResult": "AUTHENTICATION_RESULT_POSITIVE",
// Liveness result.
"livenessResult": "LIVENESS_RESULT_LIVE"
},
...
}
}
Example of the new return of the process result when user authentication is INCONCLUSIVE:
{
"process": {
...
// Current status of the process.
"state": "PROCESS_STATE_FINISHED",
// Current result of the process.
"result": "PROCESS_RESULT_OK",
// Results of the authentication step.
"authenticationInfo": {
// Process authentication id.
"authenticationId": "cf9e618e-e7a4-4340-b745-b228383c927f",
// Result of authentication with the IDUnico.
"authenticationResult": "AUTHENTICATION_RESULT_INCONCLUSIVE",
// Liveness result.
"livenessResult": "LIVENESS_RESULT_LIVE"
},
...
}
}
There is no change in the return when the process ends with liveness failure.
Example of the return of the process result when the user DOES NOT pass the liveness:
{
"process": {
...
// Current status of the process.
"state": "PROCESS_STATE_FINISHED",
// Current result of the process.
"result": "PROCESS_RESULT_INVALID_IDENTITY",
// Results of the authentication step.
"authenticationInfo": {
// Process authentication id.
"authenticationId": "cf9e618e-e7a4-4340-b745-b228383c927f",
// Result of authentication with the IDUnico.
"authenticationResult": "AUTHENTICATION_RESULT_UNSPECIFIED",
// Liveness result.
"livenessResult": "LIVENESS_RESULT_NOT_LIVE"
},
...
}
}
Ways to make a GET request
Using the process ID you can retrieve all the information about the process.
- cURL
- Postman
- NodeJS
- Java
- C#
- Go
curl -X 'GET' \
'https://api.cadastro.uat.unico.app/client/v1/process/{processId}' \
-H 'accept: application/json' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer {{TOKEN}}'
Remember to replace the processId
with the id of the desired process.
To use Postman, follow these steps:
- Select the GET method.
- Enter the URL
https://api.cadastro.uat.unico.app/client/v1/process/
and add the id of your process. - Select the Authorization tab.
- In the Type list, select Bearer Token.
- Enter the token obtained in the Token field with the prefix
Bearer
.
const axios = require('axios');
const TOKEN = '<YOUR_TOKEN>';
const processId = '_YOUR_PROCESS_ID'; // Replace with the ID of the process you want to access
const headers = {
'accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': `Bearer ${TOKEN}`
};
const apiUrl = `https://api.cadastro.uat.unico.app/client/v1/process/${processId}`;
axios.get(apiUrl, { headers })
.then(response => {
console.log('API response:', response.data);
})
.catch(error => {
console.error('Request error:', error);
});
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class ExemploRequisicaoGET {
public static void main(String[] args) {
String token = "<YOUR_TOKEN>";
String processId = "_YOUR_PROCESS_ID"; // Replace with the ID of the process you want to access
try {
URL url = new URL("https://api.cadastro.uat.unico.app/client/v1/process/" + processId);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
// Defina os cabeçalhos da requisição
connection.setRequestProperty("accept", "application/json");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Authorization", "Bearer " + token);
int responseCode = connection.getResponseCode();
if (responseCode == HttpURLConnection.HTTP_OK) {
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String inputLine;
StringBuilder response = new StringBuilder();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println("API response: " + response.toString());
} else {
System.err.println("Request error. Response code: " + responseCode);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
string token = "<YOUR_TOKEN>";
string processId = "_YOUR_PROCESS_ID"; // Replace with the ID of the process you want to access
using (HttpClient client = new HttpClient())
{
client.BaseAddress = new Uri("https://api.cadastro.uat.unico.app/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token);
HttpResponseMessage response = await client.GetAsync($"client/v1/process/{processId}");
if (response.IsSuccessStatusCode)
{
string responseBody = await response.Content.ReadAsStringAsync();
Console.WriteLine("API response: " + responseBody);
}
else
{
Console.WriteLine("Request error. Response code: " + response.StatusCode);
}
}
}
}
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
token := "<YOUR_TOKEN>"
processId := "_YOUR_PROCESS_ID"; // Replace with the ID of the process you want to access
url := fmt.Sprintf("https://api.cadastro.uat.unico.app/client/v1/process/%s", processId)
client := &http.Client{}
req, err := http.NewRequest("GET", url, nil)
if err != nil {
fmt.Println("Error when creating the request:", err)
return
}
req.Header.Add("accept", "application/json")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer " + token)
resp, err := client.Do(req)
if err != nil {
fmt.Println("Request error:", err)
return
}
defer resp.Body.Close()
if resp.StatusCode == http.StatusOK {
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
fmt.Println("Error reading the API response:", err)
return
}
fmt.Println("API response:", string(body))
} else {
fmt.Println("Request error. Response code:", resp.StatusCode)
}
}
Flows
The result is displayed according to the flow.
1 - ID flow
2 - IDCheck flow (IDUnico + Check)
3 - IDDocs flow (IDUnico + Check + Docs)