# Integração do BCC Services

## Introdução

BCC Services é um componente de software usado para captura biométrica. O BCC Services é usado para coletar imagens biométricas, mas não as envia automaticamente para o servidor. Você pode ver como enviar uma captura para o GBDS na seção [Cadastro no GBDS](#cadastro-no-gbds).

{% hint style="warning" %}
O BCC Services não salva os dados biométricos coletados e apenas os mantêm na RAM enquanto estiver ativo. Reiniciar ou desligar o computador ou fechar o BCC Services resultará na perda das coleções.
{% endhint %}

Este manual descreve o fluxo de trabalho e a solução de problemas padrão de captura biométrica do BCC Services. Consulte a [especificação da API do BCC Services](/apis/bcc-services.md) para obter mais informações sobre as chamadas de API.

Este manual está atualizado para a versão 2.8.8 do BCC Services.

## Fluxo de Captura

Esta seção descreverá o fluxo de captura e as opções de capturas biométricas que você pode realizar com BCC Services. Um exemplo das chamadas e respostas do endpoint pode ser visto no [Exemplo de Fluxo de Captura](#exemplo-de-fluxo-de-captura)

Para iniciar uma captura, você precisa chamar um dos endpoints de captura biométrica. Esses são:

* [Captura de Iris](https://gitbook.griaule.com/apis/bcc-services/biometric-capture#post-bcc-capture-irises)
* [Captura de Palmar](https://gitbook.griaule.com/apis/bcc-services/biometric-capture#post-bcc-capture-palm)
* [Captura de Assinatura](https://gitbook.griaule.com/apis/bcc-services/biometric-capture#post-bcc-capture-signature)
* [Captura de Impressão Digital](https://gitbook.griaule.com/apis/bcc-services/biometric-capture#post-bcc-capture-fingerprint)
* [Captura de Palmar de Recém-nascido](https://gitbook.griaule.com/apis/bcc-services/biometric-capture#post-bcc-capture-baby-palm)
* [Captura de Face](https://gitbook.griaule.com/apis/bcc-services/biometric-capture#post-bcc-capture-face)
* [Captura de Imagem Auxiliar](https://gitbook.griaule.com/apis/bcc-services/biometric-capture#post-bcc-capture-auxiliary-image)
* [Captura de Perfil Completo](https://gitbook.griaule.com/apis/bcc-services/biometric-capture#post-bcc-capture-profile)

Essas capturas podem retornar uma de duas respostas:

* **200**, para OK
* **400**, para ERRO

O status **200** terá um campo `tguid` que você deve salvar. Cada chamada de Captura Biométrica terá seu ID único, independente de quantas capturas forem realizadas na mesma chamada. ou seja, você pode realizar a chamada [Captura de Impressão Digital](https://gitbook.griaule.com/apis/bcc-services/biometric-capture#post-bcc-capture-fingerprint) para coletar todos os dez dedos, gerando um tguid para todas as capturas, ou usando o mesmo endpoint dez vezes, gerando um tguid para cada impressão digital.

A captura biométrica gera uma janela de captura. Para obter o status de captura, execute a [chamada de status](https://gitbook.griaule.com/apis/bcc-services/capture-instance-status#get-bcc-capture-status). Este endpoint retornará o status de captura, as informações do sensor e uma informação parcial de quais biometrias são capturadas.

Você deve realizar a chamada de `status` até que o valor do campo `status` seja `captured`. Isso indicará que a captura foi concluída. Outros status podem ser vistos se a captura estiver incompleta, como `capturing` se a janela de captura ainda estiver aberta ou `closed` se a janela de captura tiver sido fechada sem concluir a captura.

Ao obter o status `captured`, você precisa executar a chamada de [getProfile](https://gitbook.griaule.com/apis/bcc-services/capture-instance-status#get-bcc-capture). A resposta desta chamada contém as imagens `.wsq` e `.jpeg`. Essas estão no campo `buffer` e `convertido-buffer`, respectivamente, como bytearrays no formato base64.

Após a conclusão de uma captura, recomendamos salvar as imagens em um banco de dados local até enviá-las ao servidor.

{% hint style="danger" %}
BCC Services salva a captura na RAM. Sair do BCC Services, desligar ou reiniciar o computador sem persistir os dados da transação resultará em perda de dados.
{% endhint %}

Depois que todas as capturas necessárias forem feitas, reinicie os serviços BCC usando a chamada [restartBcc](https://gitbook.griaule.com/apis/bcc-services/capture-instance-status#delete-bcc-capture-restart).

{% hint style="warning" %}
Reiniciar o BCC Services limpará todos os dados de transações na RAM. Garanta que seus dados estejam salvos antes de reiniciar o BCC Services.
{% endhint %}

A chamada `restartBcc` encerrará o BCC Services e o reabrirá automaticamente. Para garantir que o software esteja em execução após a reinicialização, execute a chamada [serviceStatus](https://gitbook.griaule.com/apis/bcc-services/bcc-service-status#get-bcc-running) e verifique se o valor do campo `serverState` é `running`.

### Reabrir janela de captura incompleta

Se o usuário fechou a janela de captura sem finalizar a captura, a [chamada de status](https://gitbook.griaule.com/apis/bcc-services/capture-instance-status#get-bcc-capture-status) retornará o valor do `status` como `closed`. Você pode continuar uma captura interrompida com a chamada [openCapture](https://gitbook.griaule.com/apis/bcc-services/capture-instance-status#get-bcc-capture-open) passando o `tguid` fornecido pela chamada de captura biométrica. Isso manterá o progresso da captura.

### Recuperando TGUID

Se você perdeu um TGUID por qualquer motivo, poderá recuperar o TGUID usando a chamada [listCaptureInstances](https://gitbook.griaule.com/apis/bcc-services/capture-instance-status#get-bcc-capture-instances). Dentro do array de `instances`, você pode encontrar todas as capturas biométricas realizadas enquanto o BCC Services estava ativo (se o histórico de transações não foi limpo). Ele listará na ordem de execução, a primeira será a primeira Captura Biométrica chamada e a última será a última Captura Biométrica chamada. Um exemplo de resposta é mostrado abaixo.

```json
{
	"result": "OK",
	"instances": [
		{
			"tguid": "F1F14ADA-6A00-4A67-B887-F574764ECC77",
			"type": "FINGERPRINT"
		},
		{
			"tguid": "DD08CEAA-B508-421D-8484-717DF01C0C55",
			"type": "SIGNATURE"
		},
		{
			"tguid": "EB321A10-F2B2-46DB-9479-8A6E5A1A485D",
			"type": "PROFILE"
		}
	]
}
```

## Solução de Problemas

O BCC Services tem algumas chamadas para solução de problemas que você pode fazer e garantir que as coisas estejam funcionando corretamente. Tal como se seus equipamentos estão sendo identificados e se a versão do software é conhecida por você e pela equipe de suporte que pode ajudá-lo com seu problema. Essas chamadas são apresentadas a seguir.

### Versão

Verificar a versão do software é essencial para o cenário de solução de problemas. Para verificar a versão do BCC Services, execute a [chamada de versão](https://gitbook.griaule.com/apis/bcc-services/bcc-service-status).

### Execução

Para verificar se o programa está executando, use a [chamada de serviceStatus](https://gitbook.griaule.com/apis/bcc-services/bcc-service-status#get-bcc-running) e observe o valor do campo `serverState`.

### Dispositivos

O BCC Services oferece uma opção para mostrar todos os dispositivos que estão conectados a ele. Para exibir a lista de dispositivos, execute a chamada [deviceStatus](https://gitbook.griaule.com/apis/bcc-services/bcc-service-status#get-bcc-status-devices).

## Desligamento

Para desligar o BCC Services, chame [finishService](https://gitbook.griaule.com/apis/bcc-services/bcc-service-status#get-bcc-bye)

## Exemplo de Fluxo de Captura

Neste exemplo, descreveremos como realizar as chamadas para um registro de uma captura rolada de todos os dedos da mão esquerda.

Primeiro, execute a [Chamada de Captura de Impressão Digital](https://gitbook.griaule.com/apis/bcc-services/biometric-capture#post-bcc-capture-fingerprint) com a seguinte query:

{% hint style="info" %}
O campo `captureMode` não afeta o comportamento da captura do BCC Services. Este campo é utilizado para identificar a operação no BCC.
{% endhint %}

```json
{
	"captureMode": "REGISTER",
	"notifyUrl": "",
	"theme": "DARK",
	"captureType": "ROLLED",
	"type": "FINGERPRINT",
	"sequenceControlType": "NONE",
	"indexes": [
		{
			"index": "LEFT_LITTLE"
		},
		{
			"index": "LEFT_RING"
		},
		{
			"index": "LEFT_MIDDLE"
		},
		{
			"index": "LEFT_INDEX"
		},
		{
			"index": "LEFT_THUMB"
		}
	],
	"exceptionSetType": "SIMPLIFIED",
	"functions": [
		{
			"type": "RESET",
			"enabled": true
		},
		{
			"type": "CONFIG",
			"enabled": true
		},
		{
			"type": "CLEAR",
			"enabled": true
		},
		{
			"type": "CAPTURE",
			"enabled": true
		},
		{
			"type": "CANCEL",
			"enabled": true
		},
		{
			"type": "CAPTURE_NEW_IMAGE",
			"enabled": true
		},
		{
			"type": "IMAGE_PREVIEW",
			"enabled": true
		},
		{
			"type": "NEXT",
			"enabled": true
		},
		{
			"type": "OK",
			"enabled": true
		},
		{
			"type": "UPDATE_IMAGE",
			"enabled": true
		},
		{
			"type": "REMOVE_IMAGE",
			"enabled": true
		},
		{
			"type": "LIVE",
			"enabled": true
		},
		{
			"type": "ACQUIRE",
			"enabled": true
		},
		{
			"type": "SAVE",
			"enabled": true
		},
		{
			"type": "IMPORT",
			"enabled": true
		}
	]
}
```

Se a tela for aberta com sucesso, você receberá este JSON:

```json
{
	"result": "OK",
	"tguid": "F1F14ADA-6A00-4A67-B887-F574764ECC77"
}
```

Copie este TGUID e comece a chamar [status](https://gitbook.griaule.com/apis/bcc-services/capture-instance-status#get-bcc-capture-status). até receber o status `captured`.

{% hint style="warning" %}
Lembre-se que outros status, como `closed`, também podem ser retornados caso o operador não complete a captura.
{% endhint %}

Se nenhum dedo foi capturado, a resposta deve ser:

```json
{
	"result": "OK",
	"tguid": "F1F14ADA-6A00-4A67-B887-F574764ECC77",
	"type": "FINGERPRINT",
	"status": "CAPTURING",
	"operation": "INIT",
	"command": "INIT",
	"profile": {},
	"profileMetadata": {
		"profileVersion": "GBS BCC profile v2.8.7",
		"appName": "GBS BCC",
		"macAddress": [
			"08-62-66-80-D5-5C",
			"42-E2-30-11-DB-15",
			"42-E2-30-11-D3-15",
			"08-62-66-80-D4-94",
			"40-E2-30-13-F7-8A",
			"40-E2-30-11-D3-15"
		],
		"softwareStatus": {
			"vendor": "Griaule Biometrics Ltda.",
			"version": "2.8.7.10805",
			"name": "GBS BCC Service"
		},
		"fingerprintPluggedDevices": [],
		"fingerprintStartedDevices": [],
		"faceDevice": {
			"productName": "OBS Virtual Camera",
			"serialNumber": "N/A",
			"firmwareVersion": "N/A"
		},
		"bodyDevice": {
			"productName": "OBS Virtual Camera",
			"serialNumber": "N/A",
			"firmwareVersion": "N/A"
		},
		"signatureDevice": {
			"serialNumber": "N/A"
		},
		"irisDevice": "IRITECH",
		"fields": [],
		"fingerprints": [],
		"palms": [],
		"bodyImages": []
	},
	"windowInfo": {
		"x": 683.0,
		"y": 237.0,
		"width": 685.0,
		"height": 579.0,
		"state": "NORMAL"
	}
}
```

Se alguns dedos foram capturados, mas a captura não foi finalizada, o `status` responderá com as informações de captura parcial, conforme mostrado:

```json
{
	"result": "OK",
	"tguid": "F1F14ADA-6A00-4A67-B887-F574764ECC77",
	"type": "FINGERPRINT",
	"status": "CAPTURING",
	"operation": "INIT",
	"command": "INIT",
	"profileMetadata": {
		"profileVersion": "GBS BCC profile v2.8.7",
		"appName": "GBS BCC",
		"macAddress": [
			"08-62-66-80-D5-5C",
			"42-E2-30-11-DB-15",
			"42-E2-30-11-D3-15",
			"08-62-66-80-D4-94",
			"40-E2-30-13-F7-8A",
			"40-E2-30-11-D3-15"
		],
		"softwareStatus": {
			"vendor": "Griaule Biometrics Ltda.",
			"version": "2.8.7.10805",
			"name": "GBS BCC Service"
		},
		"fingerprintPluggedDevices": [],
		"fingerprintStartedDevices": [],
		"faceDevice": {
			"productName": "OBS Virtual Camera",
			"serialNumber": "N/A",
			"firmwareVersion": "N/A"
		},
		"bodyDevice": {
			"productName": "OBS Virtual Camera",
			"serialNumber": "N/A",
			"firmwareVersion": "N/A"
		},
		"signatureDevice": {
			"serialNumber": "N/A"
		},
		"irisDevice": "IRITECH",
		"fields": [],
		"fingerprints": [
			{
				"index": "LEFT_LITTLE",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left little",
				"image": {
					"resolution": 500
				},
				"height": 480,
				"width": 320,
				"template": {
					"quality": 96
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 72,
				"captured": false,
				"extracted": true
			},
			{
				"index": "LEFT_RING",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left ring",
				"image": {
					"resolution": 500
				},
				"height": 480,
				"width": 320,
				"template": {
					"quality": 98
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 66,
				"captured": false,
				"extracted": true
			}
		],
		"palms": [],
		"bodyImages": []
	},
	"windowInfo": {
		"x": 683.0,
		"y": 237.0,
		"width": 685.0,
		"height": 579.0,
		"state": "NORMAL"
	}
}
```

Após o término da captura, o campo de `status` mudará para `captured` e a chamada de `status` responderá com:

{% hint style="warning" %}
Os valores `BYTEARRAY` são strings no formato base64.
{% endhint %}

```json
{
	"result": "OK",
	"tguid": "F1F14ADA-6A00-4A67-B887-F574764ECC77",
	"type": "FINGERPRINT",
	"status": "CAPTURED",
	"operation": "INIT",
	"command": "NONE",
	"profileMetadata": {
		"profileVersion": "GBS BCC profile v2.8.7",
		"appName": "GBS BCC",
		"macAddress": [
			"08-62-66-80-D5-5C",
			"42-E2-30-11-DB-15",
			"42-E2-30-11-D3-15",
			"08-62-66-80-D4-94",
			"40-E2-30-13-F7-8A",
			"40-E2-30-11-D3-15"
		],
		"softwareStatus": {
			"vendor": "Griaule Biometrics Ltda.",
			"version": "2.8.7.10805",
			"name": "GBS BCC Service"
		},
		"fingerprintPluggedDevices": [],
		"fingerprintStartedDevices": [],
		"faceDevice": {
			"productName": "OBS Virtual Camera",
			"serialNumber": "N/A",
			"firmwareVersion": "N/A"
		},
		"bodyDevice": {
			"productName": "OBS Virtual Camera",
			"serialNumber": "N/A",
			"firmwareVersion": "N/A"
		},
		"signatureDevice": {
			"serialNumber": "N/A"
		},
		"irisDevice": "IRITECH",
		"fields": [],
		"fingerprints": [
			{
				"index": "LEFT_LITTLE",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left little",
				"image": {
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"quality": 96
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 72,
				"captured": false,
				"extracted": true
			},
			{
				"index": "LEFT_RING",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left ring",
				"image": {
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"quality": 98
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 66,
				"captured": false,
				"extracted": true
			},
			{
				"index": "LEFT_MIDDLE",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left middle",
				"image": {
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"quality": 98
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 76,
				"captured": false,
				"extracted": true
			},
			{
				"index": "LEFT_INDEX",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left index",
				"image": {
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"quality": 100
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 71,
				"captured": false,
				"extracted": true
			},
			{
				"index": "LEFT_THUMB",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left thumb",
				"image": {
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"quality": 100
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 70,
				"captured": false,
				"extracted": true
			}
		],
		"palms": [],
		"bodyImages": []
	},
	"windowInfo": {
		"x": 683.0,
		"y": 237.0,
		"width": 1000.0,
		"height": 579.0,
		"state": "NORMAL"
	}
}
```

{% hint style="info" %}
Após uma transação completa, a chamada de status responde com as imagens `.jpeg`.
{% endhint %}

Agora é hora de realizar a chamada [getProfile](https://gitbook.griaule.com/apis/bcc-services/capture-instance-status#get-bcc-capture). Esta chamada responderá com as imagens em imagens `.wsq` e `.jpeg`. O campo `buffer` contém as imagens `.wsq` enquanto o campo `converted-buffer` contém as imagens `.jpeg`.

```json
{
	"result": "OK",
	"tguid": "F1F14ADA-6A00-4A67-B887-F574764ECC77",
	"type": "FINGERPRINT",
	"status": "CAPTURED",
	"operation": "INIT",
	"command": "NONE",
	"profile": {
		"fingerprints": [
			{
				"index": "LEFT_LITTLE",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left little",
				"image": {
					"buffer": "BYTEARRAY",
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"buffer": "BYTEARRAY",
					"quality": 96
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 72,
				"captured": false,
				"extracted": true
			},
			{
				"index": "LEFT_RING",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left ring",
				"image": {
					"buffer": "BYTEARRAY",
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"buffer": "BYTEARRAY",
					"quality": 98
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 66,
				"captured": false,
				"extracted": true
			},
			{
				"index": "LEFT_MIDDLE",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left middle",
				"image": {
					"buffer": "BYTEARRAY",
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"buffer": "BYTEARRAY",
					"quality": 98
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 76,
				"captured": false,
				"extracted": true
			},
			{
				"index": "LEFT_INDEX",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left index",
				"image": {
					"buffer": "BYTEARRAY",
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"buffer": "BYTEARRAY",
					"quality": 100
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 71,
				"captured": false,
				"extracted": true
			},
			{
				"index": "LEFT_THUMB",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left thumb",
				"image": {
					"buffer": "BYTEARRAY",
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"buffer": "BYTEARRAY",
					"quality": 100
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 70,
				"captured": false,
				"extracted": true
			}
		]
	},
	"profileMetadata": {
		"profileVersion": "GBS BCC profile v2.8.7",
		"appName": "GBS BCC",
		"macAddress": [
			"08-62-66-80-D5-5C",
			"42-E2-30-11-DB-15",
			"42-E2-30-11-D3-15",
			"08-62-66-80-D4-94",
			"40-E2-30-13-F7-8A",
			"40-E2-30-11-D3-15"
		],
		"softwareStatus": {
			"vendor": "Griaule Biometrics Ltda.",
			"version": "2.8.7.10805",
			"name": "GBS BCC Service"
		},
		"fingerprintPluggedDevices": [],
		"fingerprintStartedDevices": [],
		"faceDevice": {
			"productName": "OBS Virtual Camera",
			"serialNumber": "N/A",
			"firmwareVersion": "N/A"
		},
		"bodyDevice": {
			"productName": "OBS Virtual Camera",
			"serialNumber": "N/A",
			"firmwareVersion": "N/A"
		},
		"signatureDevice": {
			"serialNumber": "N/A"
		},
		"irisDevice": "IRITECH",
		"fields": [],
		"fingerprints": [
			{
				"index": "LEFT_LITTLE",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left little",
				"image": {
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"quality": 96
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 72,
				"captured": false,
				"extracted": true
			},
			{
				"index": "LEFT_RING",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left ring",
				"image": {
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"quality": 98
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 66,
				"captured": false,
				"extracted": true
			},
			{
				"index": "LEFT_MIDDLE",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left middle",
				"image": {
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"quality": 98
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 76,
				"captured": false,
				"extracted": true
			},
			{
				"index": "LEFT_INDEX",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left index",
				"image": {
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"quality": 100
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 71,
				"captured": false,
				"extracted": true
			},
			{
				"index": "LEFT_THUMB",
				"type": "ROLLED",
				"typeIndexKey": "ROLLED-left thumb",
				"image": {
					"resolution": 500,
					"converted-buffer": "BYTEARRAY"
				},
				"height": 480,
				"width": 320,
				"template": {
					"quality": 100
				},
				"captureType": "FLAT",
				"nfiq": 1,
				"contrast": 70,
				"captured": false,
				"extracted": true
			}
		],
		"palms": [],
		"bodyImages": []
	},
	"windowInfo": {
		"x": 683.0,
		"y": 237.0,
		"width": 685.0,
		"height": 579.0,
		"state": "NORMAL"
	}
}
```

Após a captura, você pode enviar as imagens para o servidor. Para entender como registrar a biometria capturada no GBDS, vá para a próxima seção.

### Cadastro no GBDS

Chame o [endpoint de enroll](https://gitbook.griaule.com/apis/gbds-4/people#post-people) se desejar registrar as imagens capturadas anteriormente no GBDS.

No payload você precisa inserir as informações das chaves (keys), e biográficos (biographics). Dentro do array `biometric`, você precisará inserir os dados do endpoint `getCapture` do BCC Services.

O valor do campo `buffer` BCC Services precisa ser colocado no valor do campo `content` no payload do JSON para o GBDS.

{% hint style="info" %}
Para obter mais informações sobre operações no GBDS, consulte o Manual de Integração do GBDS.
{% endhint %}

O payload de exemplo para realizar o registro é mostrada abaixo:

```json
{
	"meta": {
		"priority": "DEFAULT_PRIORITY",
		"timeout": "-1"
	},
	"data": {
		"keys": [
			{
				"id": "CPF",
				"value": "618.323.606-44"
			}
		],
		"biographics": [
			{
				"id": "name",
				"value": "John Doe"
			}
		],
		"biometric": [
			{
				"source": "ORIGINAL",
				"type": "FINGERPRINT",
				"format": "WSQ",
				"properties": {
					"width": 0,
					"height": 0,
					"resolution": 500,
					"ratio": 0.0,
					"matcherId": 0,
					"extractorId": 0
				},
				"index": 0,
				"content": "BYTEARRAY"
			},
			{
				"source": "ORIGINAL",
				"type": "FINGERPRINT",
				"format": "WSQ",
				"properties": {
					"width": 0,
					"height": 0,
					"resolution": 500,
					"ratio": 0.0,
					"matcherId": 0,
					"extractorId": 0
				},
				"index": 1,
				"content": "BYTEARRAY"
			},
			{
				"source": "ORIGINAL",
				"type": "FINGERPRINT",
				"format": "WSQ",
				"properties": {
					"width": 0,
					"height": 0,
					"resolution": 500,
					"ratio": 0.0,
					"matcherId": 0,
					"extractorId": 0
				},
				"index": 2,
				"content": "BYTEARRAY"
			},
			{
				"source": "ORIGINAL",
				"type": "FINGERPRINT",
				"format": "WSQ",
				"properties": {
					"width": 0,
					"height": 0,
					"resolution": 500,
					"ratio": 0.0,
					"matcherId": 0,
					"extractorId": 0
				},
				"index": 3,
				"content": "BYTEARRAY"
			},
			{
				"source": "ORIGINAL",
				"type": "FINGERPRINT",
				"format": "WSQ",
				"properties": {
					"width": 0,
					"height": 0,
					"resolution": 500,
					"ratio": 0.0,
					"matcherId": 0,
					"extractorId": 0
				},
				"index": 4,
				"content": "BYTEARRAY"
			}
		]
	}
}
```

### Anotação de anomalia na captura

Para que uma anomalia na captura da impressão digital seja registrada, o metadado da transação deve incluir o objeto `fingerprints`. Este objeto deve conter os índices dos dedos e suas respectivas anomalias.

**Exemplo**:

```json
"fingerprints": [
    {
        "index": "LEFT_LITTLE",
        "anomaly": "AMPUTATED"
    }
]
```

**Os índices são ENUMs:**

* `LEFT_LITTLE`
* `LEFT_RING`
* `LEFT_MIDDLE`
* `LEFT_INDEX`
* `LEFT_THUMB`
* `RIGHT_THUMB`
* `RIGHT_INDEX`
* `RIGHT_MIDDLE`
* `RIGHT_RING`
* `RIGHT_LITTLE`

**Os tipos de anomalias são:**

* `DAMAGED`
* `BANDAGED`
* `IGNORED`
* `AMPUTATED`

O **metadado** precisa ser adicionado ao *enroll* em formato base64, da seguinte forma:

{% code fullWidth="false" %}

```json
"data": {
    "keys": [
		...
    ],
    "biographics": [
    	...
    ],
    "labels": [
        ...
    ],
    "metadata": "ewoJInByb2ZpbGVWZXJzaW9uIjogIkdCRFMgcHJvZmlsZSIsCgkiYXBwTmFtZSI6ICJHQkRTIiwKCSJmaW5nZXJwcmludHMiOiBbCgkJewoJCQkiaW5kZXgiOiAiTEVGVF9MSVRUTEUiLAoJCQkidHlwZSI6ICJST0xMRUQiLAoJCQkidHlwZUluZGV4S2V5IjogIlJPTExFRC1MRUZUX0xJVFRMRSIsCgkJCSJjYXB0dXJlVHlwZSI6ICJST0xMRUQiLAoJCQkiYW5vbWFseSI6ICJEQU1BR0VEIiwKCQkJIm5maXEiOiAwLAoJCQkiY29udHJhc3QiOiAwLAoJCQkiY2FwdHVyZWQiOiBmYWxzZSwKCQkJImV4dHJhY3RlZCI6IGZhbHNlCgkJfSwKCQl7CgkJCSJpbmRleCI6ICJMRUZUX1JJTkciLAoJCQkidHlwZSI6ICJST0xMRUQiLAoJCQkidHlwZUluZGV4S2V5IjogIlJPTExFRC1MRUZUX1JJTkciLAoJCQkiY2FwdHVyZVR5cGUiOiAiUk9MTEVEIiwKCQkJImFub21hbHkiOiAiQkFOREFHRUQiLAoJCQkibmZpcSI6IDAsCgkJCSJjb250cmFzdCI6IDAsCgkJCSJjYXB0dXJlZCI6IGZhbHNlLAoJCQkiZXh0cmFjdGVkIjogZmFsc2UKCQl9LAoJCXsKCQkJImluZGV4IjogIkxFRlRfTUlERExFIiwKCQkJInR5cGUiOiAiUk9MTEVEIiwKCQkJInR5cGVJbmRleEtleSI6ICJST0xMRUQtTEVGVF9NSURETEUiLAoJCQkiY2FwdHVyZVR5cGUiOiAiUk9MTEVEIiwKCQkJImFub21hbHkiOiAiSUdOT1JFRCIsCgkJCSJuZmlxIjogMCwKCQkJImNvbnRyYXN0IjogMCwKCQkJImNhcHR1cmVkIjogZmFsc2UsCgkJCSJleHRyYWN0ZWQiOiBmYWxzZQoJCX0sCgkJewoJCQkiaW5kZXgiOiAiTEVGVF9JTkRFWCIsCgkJCSJ0eXBlIjogIlJPTExFRCIsCgkJCSJ0eXBlSW5kZXhLZXkiOiAiUk9MTEVELUxFRlRfSU5ERVgiLAoJCQkiY2FwdHVyZVR5cGUiOiAiUk9MTEVEIiwKCQkJImFub21hbHkiOiAiQU1QVVRBVEVEIiwKCQkJIm5maXEiOiAwLAoJCQkiY29udHJhc3QiOiAwLAoJCQkiY2FwdHVyZWQiOiBmYWxzZSwKCQkJImV4dHJhY3RlZCI6IGZhbHNlCgkJfQogICAgXQp9",
    "biometric": [
		...
    ]
}
```

{% endcode %}

O campo `"metadata"`, representado em base64 no exemplo acima, corresponde ao seguinte JSON:

{% hint style="info" %}
O JSON deve conter pelo menos o campo “*fingerprints*” e dentro de cada item no mínimo os campos "index" e "anomaly".
{% endhint %}

```json
{
    "profileVersion": "GBDS profile",
    "appName": "GBDS",
    "fingerprints": [
        {
            "index": "LEFT_LITTLE",
            "type": "ROLLED",
            "typeIndexKey": "ROLLED-LEFT_LITTLE",
            "captureType": "ROLLED",
            "anomaly": "DAMAGED",
            "nfiq": 0,
            "contrast": 0,
            "captured": false,
            "extracted": false
        },
        {
            "index": "LEFT_RING",
            "type": "ROLLED",
            "typeIndexKey": "ROLLED-LEFT_RING",
            "captureType": "ROLLED",
            "anomaly": "BANDAGED",
            "nfiq": 0,
            "contrast": 0,
            "captured": false,
            "extracted": false
        },
        {
            "index": "LEFT_MIDDLE",
            "type": "ROLLED",
            "typeIndexKey": "ROLLED-LEFT_MIDDLE",
            "captureType": "ROLLED",
            "anomaly": "IGNORED",
            "nfiq": 0,
            "contrast": 0,
            "captured": false,
            "extracted": false
        },
        {
            "index": "LEFT_INDEX",
            "type": "ROLLED",
            "typeIndexKey": "ROLLED-LEFT_INDEX",
            "captureType": "ROLLED",
            "anomaly": "AMPUTATED",
            "nfiq": 0,
            "contrast": 0,
            "captured": false,
            "extracted": false
        }
    ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.griaule.com/integracao-do-gbds/bccservicesintegration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
