# Solicitud HTTP

{% hint style="info" %}
Disponible en el plan **PREMIUM** y superiores.
{% endhint %}

Si desea enviar o recuperar datos de un tercero con el que TopBot no tiene una integración nativa, puede utilizar el bloque de acción de solicitud HTTP.

La solicitud HTTP le permite invocar un punto final de API y realizar una operación **GET / POST / PUT .**

### Pedido <a href="#request" id="request"></a>

Configure los detalles para su solicitud de API.

#### Métodos <a href="#methods" id="methods"></a>

Elija el método del punto final de API que desea invocar. TopBot admite:

* CONSEGUIR
* CORREO
* PONER

#### **URL del punto final** <a href="#endpoint-url" id="endpoint-url"></a>

Debe proporcionar la URL absoluta, es decir, una URL que comience con HTTP o HTTPS.

También puedes utilizar las variables en la URL escribiendo '#', ya que algunas API no tienen encabezados y mencionan todo en la propia URL.

{% code overflow="wrap" %}

```
https://api.weatherapi.com/v1/current.json?key=e943b863ebed4572b55140350200312&q=#city#

Here in the above URL #city# is the variable that has been used
```

{% endcode %}

#### **Encabezados** <a href="#headers" id="headers"></a>

Añade datos de autenticación a la solicitud HTTP. Se utiliza habitualmente para la autenticación basada en tokens de portador.

{% hint style="info" %}
Asegúrese de agregar el campo **de tipo de contenido** a su solicitud.
{% endhint %}

#### **Cuerpo** <a href="#body" id="body"></a>

Agregue la información requerida que desea enviar como parte de su solicitud.

Puedes enviar información de dos maneras:

**Crudo:**

Es el formato JSON normal en el que se debe pasar la solicitud.

![](https://help.wotnot.io/~gitbook/image?url=https%3A%2F%2F360969599-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsrMxU8nO3RjusUiYuXBB%252Fuploads%252FwJiVZlWrx5Jo8cxZmlRd%252FCleanShot%25202024-06-20%2520at%252019.14.22.png%3Falt%3Dmedia%26token%3D24e2f856-bad1-43b8-ae58-8e0b2389c3b9\&width=768\&dpr=4\&quality=100\&sign=e4e6b64f\&sv=1)

**Forma:**

Permite mapear los campos. Puede proporcionar un valor estático o mapear las variables.

![](https://help.wotnot.io/~gitbook/image?url=https%3A%2F%2F360969599-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FsrMxU8nO3RjusUiYuXBB%252Fuploads%252F0LDmXOTMkpI0aogiR23M%252FCleanShot%25202024-06-20%2520at%252019.15.31.png%3Falt%3Dmedia%26token%3D6bcd41cd-df5b-4a8e-94ad-8134ba6f3eff\&width=768\&dpr=4\&quality=100\&sign=e60d9e35\&sv=1)

### **Respuesta** <a href="#response" id="response"></a>

Cuando se realiza la solicitud HTTP, recibirá una respuesta de la API.

Puede almacenar los objetos recibidos de la API en variables asignando los campos.

{% code overflow="wrap" %}

```
// Object path for storing the response into variable where list is returned

result.data.list[0].id

// Here the value of the field `id` will be stored in the variable mapped to it.
Copiar
// Object path for storing the response into variable where single value is returned

result.data.id 

// Here the value of the field 'id' will be stored in the variable mapped to it.
```

{% endcode %}

### Solicitud de API de prueba <a href="#testing-api-request" id="testing-api-request"></a>

Una vez que haya configurado su solicitud de API, puede hacer clic en el botón 'Probar la API' y ver la respuesta recibida.

Desde la pantalla de respuesta, puede guardar directamente el objeto en una variable haciendo clic en el ícono +.


---

# 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://ayuda.topleads.co/topbots/integraciones/solicitud-http.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.
