# Intelligence Integration Guide

## Introduction

This manual describes the standard GBS Intelligence integration workflow, which enables biographical search in the database. Any API call mentioned in this manual must be performed according to the [GBS Intelligence API Specification](https://gitbook.griaule.com/apis/intelligence) .

{% hint style="info" %}
All calls to GBS Intelligence must be made to the ETR server, as mentioned in the API specification.
{% endhint %}

## Login

Any request to GBS Intelligence requires an authenticated login `session-guid`. To obtain it, it is necessary to send `session-guid`a login request [providing a valid username/password combination.](https://gitbook.griaule.com/apis/intelligence/endpoints#post-session)

{% hint style="info" %}
The username and password must be the same as those used to log in to GBDS and other Griaule applications.
{% endhint %}

The login operation will return a session-guid that must be provided in all requests to GBS Intelligence.

## Request Search Fields List

Any search request submitted to GBS Intelligence must specify the biographical field to be used. To check the available biographical fields, you can use [listSearchFields](https://gitbook.griaule.com/apis/intelligence/fields)

{% hint style="info" %}
If the biographic field name specified in the search request does not match a field that exists within the database, an error will be returned.
{% endhint %}

## Searching by Value

When making a search request, it is recommended to split the workflow into two steps: count and list.

By counting the results available for the search criteria provided in advance, it is possible to paginate the results, avoiding any overhead in retrieving and viewing the results.

After counting the results, it is possible to request and paginate the search results through the request query parameters.

### Count

The [count search results request](https://gitbook.griaule.com/dev/api/intelligence/profiles#post-profile-list-count) must contain the fields `name`and `value`to be searched.

{% hint style="info" %}
Any profile that contains the value to be searched within the provided biographical field will be returned as a search result, regardless of position.

for example, a regular expression that describes the search criteria would be `*value*`, with `*`being a wildcard that covers any character in any quantity.
{% endhint %}

### List

The [Search Results List](https://gitbook.griaule.com/dev/api/intelligence/profiles#post-profile-list) must also contain the fields `name`and `value`to be searched, and the search criteria will be the same as those used to count the results.

This request accepts query parameters that can be used to filter the returned list, such as `first`, which determines the position of the first result returned in the list, and `size`, which defines the number of results to be returned, starting from the `first`.

## Accessing profile details

After performing the search and retrieving the results, it is possible to use the returned PGUIDs to access profile details through the call [Request Profile](https://gitbook.griaule.com/apis/intelligence/profiles#get-profile-person-pguid).

This method will return all data for the provided PGUID profile, including biographical data and base64-encoded images.

## Image conversion tool

GBS Intelligence also provides a method to [convert images](https://gitbook.griaule.com/apis/intelligence/image-conversion#post-image-convert) into different formats, providing the original image encoded in base64, its format, and the desired format for conversion.


---

# 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/gbs/en/gbds-integration/intelligence-integration-guide.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.
