# Especificaciones de la API

### Puntos Finales (Endpoints)

A continuación se detallan los puntos finales (endpoints) de la API, los métodos HTTP soportados, los tipos de datos esperados y los formatos de las respuestas.

#### /health

* **URL del Endpoint**: `${URL_ENDPOINT}/health`
* **Método**: `GET`
* **Descripción**: Verifica el estado de salud de la API.
* **Parámetros de Entrada**: Ninguno.
* **Ejemplo de Solicitud**:

  ```
  GET /health HTTP/1.1
  Host: ${URL_ENDPOINT}
  ```
* **Ejemplo de Respuesta**:

  ```json
  "ok"
  ```

#### /campaign/exists

* **URL del Endpoint**: `${URL_ENDPOINT}/campaign/exists`
* **Método**: `POST`
* **Descripción**: Verifica si existe una campaña.
* **Parámetros de Entrada**:
  * `ExistCampaignDto`
* **Ejemplo de ExistCampaignDto**:

  ```json
  {
    "campaignSlug": "campaign-slug-example"
  }
  ```
* **Ejemplo de Solicitud**:

  ```
  POST /campaign/exists HTTP/1.1
  Host: ${URL_ENDPOINT}
  Content-Type: application/json
  ```
* **Ejemplo de Respuesta**:

  ```json
  true
  ```

#### /scrapper-config

* **URL del Endpoint**: `${URL_ENDPOINT}/scrapper-config`
* **Método**: `POST`
* **Descripción**: Obtiene la configuración del scrapper.
* **Parámetros de Entrada**:
  * `ExistCampaignDto`
* **Ejemplo de ExistCampaignDto**:

  ```json
  {
    "campaignSlug": "campaign-slug-example"
  }
  ```
* **Ejemplo de Solicitud**:

  ```
  POST /scrapper-config HTTP/1.1
  Host: ${URL_ENDPOINT}
  Content-Type: application/json
  ```
* **Ejemplo de Respuesta**:

  ```json
  [
    {
      "urlLogin": "<https://example.com/login>",
      "email": "user@example.com",
      "password": "password123",
      "s3Path": ["path/to/file"],
      "campaignSlug": ["campaign-slug-example"],
      "reportType": "REPORT_TYPE_ENUM",
      "affiliateName": "STRATEGIES_TYPES_ENUM",
      "country": "Country",
      "urlMemberReport": "<https://example.com/member-report>",
      "urlAccountReport": "<https://example.com/account-report>",
      "createdAt": "2024-01-01T00:00:00Z",
      "deletedAt": null,
      "updatedAt": "2024-01-02T00:00:00Z",
      "percentage": 10
    }
  ]
  ```

#### /api-config

* **URL del Endpoint**: `${URL_ENDPOINT}/api-config`
* **Método**: `POST`
* **Descripción**: Obtiene la configuración de la API.
* **Parámetros de Entrada**:
  * `ExistCampaignDto`
* **Ejemplo de ExistCampaignDto**:

  ```json
  {
    "campaignSlug": "campaign-slug-example"
  }
  ```
* **Ejemplo de Solicitud**:

  ```
  POST /api-config HTTP/1.1
  Host: ${URL_ENDPOINT}
  Content-Type: application/json
  ```
* **Ejemplo de Respuesta**:

  ```json
  [
    {
      "active": true,
      "affiliateName": "STRATEGIES_TYPES_ENUM",
      "campaignSlug": ["campaign-slug-example"],
      "reportType": "REPORT_TYPE_ENUM",
      "s3Path": ["path/to/file"],
      "properties": {
        "property1": "value1"
      },
      "percentage": 10,
      "createdAt": "2024-01-01T00:00:00Z",
      "deletedAt": null,
      "updatedAt": "2024-01-02T00:00:00Z"
    }
  ]
  ```
* **URL del Endpoint**: `${URL_ENDPOINT}/conditions`
* **Método**: `POST`
* **Descripción**: Crea una nueva condición.
* **Parámetros de Entrada**:
  * `CreateConditionDto`
* **Ejemplo de CreateConditionDto**:

  ```json
  {
    "campaignSlug": "campaign-slug-example",
    "expression": [
      {
        "field": "field1",
        "operator": "operator1",
        "value": "value1"
      }
    ]
  }
  ```
* **Ejemplo de Solicitud**:

  ```
  POST /conditions HTTP/1.1
  Host: ${URL_ENDPOINT}
  Content-Type: application/json
  ```
* **Ejemplo de Respuesta**:

  ```
  HTTP/1.1 200 OK
  ```

#### /campaign-data

* **URL del Endpoint**: `${URL_ENDPOINT}/campaign-data`
* **Método**: `POST`
* **Descripción**: Obtiene los datos de la campaña.
* **Parámetros de Entrada**:
  * `ExistCampaignDataDto`
* **Ejemplo de ExistCampaignDataDto**:

  ```json
  {
    "campaignSlug": "campaign-slug-example",
    "date": "2024-01-01",
    "reportType": "REPORT_TYPE_ENUM"
  }
  ```
* **Ejemplo de Solicitud**:

  ```
  POST /campaign-data HTTP/1.1
  Host: ${URL_ENDPOINT}
  Content-Type: application/json
  ```
* **Ejemplo de Respuesta**:

  ```json
  {
    "json": {
      "field1": "value1",
      "field2": "value2"
    },
    "campaignSlug": "campaign-slug-example",
    "date": "2024-01-01",
    "reportType": "REPORT_TYPE_ENUM",
    "createdAt": "2024-01-01T00:00:00Z",
    "csv": "csv data",
    "csvOriginal": "original csv data",
    "updatedAt": "2024-01-02T00:00:00Z",
    "deletedAt": null
  }
  ```

#### /data/process

* **URL del Endpoint**: `${URL_ENDPOINT}/data/process`
* **Método**: `POST`
* **Descripción**: Procesa los datos.
* **Parámetros de Entrada**:
  * `ExecutionDto`
* **Ejemplo de ExecutionDto**:

  ```json
  {
    "id": "execution-id",
    "data": {
      "fromDate": "2024-01-01",
      "toDate": "2024-01-02",
      "campaignSlug": "campaign-slug-example",
      "replaceStatic": true,
      "executeBy": "EXECUTION_BY_ENUM",
      "reportType": "REPORT_TYPE_ENUM",
      "dataSource": "DATA_SOURCE_ENUM"
    },
    "retryAttempts": 3,
    "status": "EXECUTION_STATUS_ENUM",
    "hasMaxRetries": false
  }
  ```
* **Ejemplo de Solicitud**:

  ```
  POST /data/process HTTP/1.1
  Host: ${URL_ENDPOINT}
  Content-Type: application/json
  ```
* **Ejemplo de Respuesta**:

  ```
  HTTP/1.1 200 OK
  ```

### Definiciones de Tipos

#### ExistCampaignDto

```tsx
interface ExistCampaignDto {
  readonly campaignSlug: string;
}
```

#### IScrapperConfig

```tsx
interface IScrapperConfig {
  readonly urlLogin?: string;
  readonly email?: string;
  readonly password?: string;
  readonly s3Path?: string[];
  readonly campaignSlug?: string[];
  readonly reportType?: ReportTypeEnum;
  readonly affiliateName: StrategiesTypesEnum;
  readonly country?: string;
  readonly urlMemberReport?: string;
  readonly urlAccountReport?: string;
  readonly createdAt?: Date;
  readonly deletedAt?: Date;
  readonly updatedAt?: Date;
  readonly percentage?: number;
}
```

#### IApiConfig

```tsx
interface IApiConfig {
  readonly active: boolean;
  readonly affiliateName: StrategiesTypesEnum;
  readonly campaignSlug: string[];
  readonly reportType: ReportTypeEnum;
  readonly s3Path: string[];
  readonly properties: IProperties;
  readonly percentage: number;
  readonly createdAt: Date;
  readonly deletedAt: Date | null;
  readonly updatedAt: Date | null;
}
```

#### CreateConditionDto

```tsx
interface CreateConditionDto extends ICondition {
  readonly campaignSlug: string;
  readonly expression: Expression[];
}
```

#### ICondition

```tsx
interface ICondition extends Condition {}
```

#### Condition

```tsx
interface Condition {
  readonly expression: Expression[];
  readonly campaignSlug: string;
  readonly createdAt?: Date;
  readonly deletedAt?: Date;
  readonly updatedAt?: Date;
}
```

#### ExistCampaignDataDto

```tsx
interface ExistCampaignDataDto {
  readonly campaignSlug: string;
  readonly date: string;
  readonly reportType: ReportTypeEnum;
}
```

#### ICampaignData

```tsx
interface ICampaignData {
  readonly json: AccountMemberFile;
  readonly campaignSlug: string;
  readonly date: string;
  readonly reportType: ReportTypeEnum;
  readonly createdAt: Date;
  readonly csv?: string;
  readonly csvOriginal?: string;
  readonly updatedAt?: Date | null;
  readonly deletedAt?: Date | null;
}
```

#### ExecutionDto

```tsx
interface ExecutionDto {
  id: string;
  data: DataCollectStartDto;
  retryAttempts: number;
  status: ExecutionStatusEnum;
  hasMaxRetries?: boolean;
}
```

#### DataCollectStartDto

```tsx
interface DataCollectStartDto {
  fromDate: string;
  toDate: string;
  campaignSlug: string;
  replaceStatic: boolean;
  executeBy: ExecutionByEnum;
  reportType: ReportTypeEnum;
  dataSource: DataSourceEnum;
}
```


---

# 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-affiliates.inlaze.com/reportes/data-processor/especificaciones-de-la-api.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.
