> For the complete documentation index, see [llms.txt](https://portal-integracao.intelbras.com.br/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://portal-integracao.intelbras.com.br/ct-5000-4pb/modo-online/modo-online-1.0/configurar-via-api.md).

# Configurar via API

### Habilitar Modo Online via API 1º

Para habilitar o Modo Online via API deverá ser realizado primeiramente a request apontando o servidor de envio de eventos e após realizado a requisição para configuração dos parametros de keep alive (Habilitar Modo Online via API 2º).

#### Requisição - GET

`http://192.168.1.201/cgi-bin/configManager.cgi?action=setConfig&PictureHttpUpload.Enable=true&PictureHttpUpload.UploadServerList[0].Address=192.168.1.200&PictureHttpUpload.UploadServerList[0].Port=3000&PictureHttpUpload.UploadServerList[0].Uploadpath=/notification`

| param           | type   | description                               |
| --------------- | ------ | ----------------------------------------- |
| `setConfig` \*  | String | Comando para cadastrar configuração       |
| `Enable` \*     | Number | Habilita/Desabilita o servidor de envio   |
| `Address` \*    | Number | Endereço do Servidor                      |
| `Port` \*       | Number | Porta do Servidor                         |
| `Uploadpath` \* | Number | Path do Servidor, exemplo "/notification" |

{% hint style="warning" %}
Importante: Verifique sempre as configurações de rede do seu produto, como Endereço de IP e Gateway, para garantir que o mesmo esteja acessível na rede.
{% endhint %}

#### Exemplo de Retorno - *text/plain*

```sh
OK
```

#### Exemplos

{% tabs %}
{% tab title="Python" %}

```python
 def config_online_mode(self, enable, server_address, port, path_event, device_mode, enable_keepalive, interval_keepalive, path_keepalive, timeout_keepalive, timeout_response) -> bool:
       try:
 
           url_server_config = "http://{}/cgi-bin/configManager.cgi?action=setConfig&PictureHttpUpload.Enable={}&PictureHttpUpload.UploadServerList[0].Address={}&PictureHttpUpload.UploadServerList[0].Port={}&PictureHttpUpload.UploadServerList[0].Uploadpath={}".format(
                                       str(self.ip),
                                       str(enable),
                                       str(server_address),
                                       str(port),
                                       str(path_event),
                                   )
 
           url_keepalive_config = "http://{}/cgi-bin/configManager.cgi?action=setConfig&Intelbras_ModeCfg.DeviceMode={}&Intelbras_ModeCfg.KeepAlive.Enable={}&Intelbras_ModeCfg.KeepAlive.Interval={}&Intelbras_ModeCfg.KeepAlive.Path={}&Intelbras_ModeCfg.KeepAlive.TimeOut={}&Intelbras_ModeCfg.RemoteCheckTimeout={}".format(
                                       str(self.ip),
                                       str(device_mode),
                                       str(enable_keepalive),
                                       str(interval_keepalive),
                                       str(path_keepalive),
                                       str(timeout_keepalive),
                                       str(timeout_response),
                                   )
               
           rval_events = requests.get(url_server_config, auth=self.digest_auth, stream=True, timeout=20, verify=False)  # noqa
 
           rval_keepalive = requests.get(url_keepalive_config, auth=self.digest_auth, stream=True, timeout=20, verify=False)  # noqa
 
           if rval_events.status_code != 200 or rval_keepalive.status_code != 200:
               raise Exception()
           return str(rval.text)
       except Exception:
           raise Exception("ERROR - During Set Online Mode - ")
```

{% endtab %}
{% endtabs %}

### Habilitar Modo Online via API 2º

#### Requisição - GET

`http://192.168.1.201/cgi-bin/configManager.cgi?action=setConfig&Intelbras_ModeCfg.DeviceMode=2&Intelbras_ModeCfg.KeepAlive.Enable=true&Intelbras_ModeCfg.KeepAlive.Interval=120&Intelbras_ModeCfg.KeepAlive.Path=/keepalive&Intelbras_ModeCfg.KeepAlive.TimeOut=2000&Intelbras_ModeCfg.RemoteCheckTimeout=5`

| param           | type   | description                                                                         |
| --------------- | ------ | ----------------------------------------------------------------------------------- |
| `setConfig` \*  | String | Comando para cadastrar configuração                                                 |
| `DeviceMode` \* | Number | Modo de operação, padrão 2 para Modo Online                                         |
| `Enable` \*     | Number | Habilita/Desabilitar o KeepAlive, por padrão deverá sempre ser habilitado.          |
| `Interval` \*   | Number | Intervalo de requisições do Keep Alive, medido em Segundos. Recomenda-se o valor 10 |
| `Path` \*       | Number | Path do Servidor, exemplo "/notification"                                           |
| `TimeOut` \*    | String | Tempo limite para o servidor responder o keep alive, recomendado 2000               |

#### Exemplo de Retorno - *text/plain*

```sh
OK
```

#### Exemplos

{% tabs %}
{% tab title="Python" %}

```python
 def config_online_mode(self, enable, server_address, port, path_event, device_mode, enable_keepalive, interval_keepalive, path_keepalive, timeout_keepalive, timeout_response) -> bool:
       try:
 
           url_server_config = "http://{}/cgi-bin/configManager.cgi?action=setConfig&PictureHttpUpload.Enable={}&PictureHttpUpload.UploadServerList[0].Address={}&PictureHttpUpload.UploadServerList[0].Port={}&PictureHttpUpload.UploadServerList[0].Uploadpath={}".format(
                                       str(self.ip),
                                       str(enable),
                                       str(server_address),
                                       str(port),
                                       str(path_event),
                                   )
 
           url_keepalive_config = "http://{}/cgi-bin/configManager.cgi?action=setConfig&Intelbras_ModeCfg.DeviceMode={}&Intelbras_ModeCfg.KeepAlive.Enable={}&Intelbras_ModeCfg.KeepAlive.Interval={}&Intelbras_ModeCfg.KeepAlive.Path={}&Intelbras_ModeCfg.KeepAlive.TimeOut={}&Intelbras_ModeCfg.RemoteCheckTimeout={}".format(
                                       str(self.ip),
                                       str(device_mode),
                                       str(enable_keepalive),
                                       str(interval_keepalive),
                                       str(path_keepalive),
                                       str(timeout_keepalive),
                                       str(timeout_response),
                                   )
               
           rval_events = requests.get(url_server_config, auth=self.digest_auth, stream=True, timeout=20, verify=False)  # noqa
 
           rval_keepalive = requests.get(url_keepalive_config, auth=self.digest_auth, stream=True, timeout=20, verify=False)  # noqa
 
           if rval_events.status_code != 200 or rval_keepalive.status_code != 200:
               raise Exception()
           return str(rval.text)
       except Exception:
           raise Exception("ERROR - During Set Online Mode - ")
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://portal-integracao.intelbras.com.br/ct-5000-4pb/modo-online/modo-online-1.0/configurar-via-api.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
