# Referință API pentru monitoare

Source: https://instatus.com/help/ro/api/monitors

- [Monitors](https://instatus.com/help/ro/api/monitors#get-monitors): Check the uptime of your websites, APIs, and services
- [Cron Monitors](https://instatus.com/help/ro/api/monitors#cron-monitors): Monitor your scheduled jobs via HTTP pings

## Valori posibile pentru câmpuri

**Locația monitorului**

| Valoare | Descriere |
| ---------------- | ----------------- |
| `US_EAST_1` | N. Virginia |
| `CA_CENTRAL_1` | Canada (Montreal) |
| `EU_CENTRAL_1` | Frankfurt |
| `AP_NORTHEAST_1` | Tokyo |

**Tipuri de alerte de monitor**

| Valoare | Descriere |
| ----------------- | --------------------- |
| `INCIDENT` | Alertă de incident |
| `EMAIL` | Alertă prin e-mail |
| `SMS` | Alertă prin SMS |
| `SLACK` | Alertă prin Slack |
| `DISCORD` | Alertă prin Discord |
| `MICROSOFT_TEAMS` | Alertă prin Microsoft Teams |
| `PHONE_CALL` | Alertă prin apel telefonic |
| `WEBHOOK` | Alertă prin webhook |
| `GOOGLE_CHAT` | Alertă prin Google Chat |
| `WHATSAPP` | Alertă prin WhatsApp |

**Starea monitorului**

| Valoare | Descriere |
| ---------- | --------------------------------- |
| `UP` | Monitorul funcționează normal |
| `DOWN` | Monitorul a căzut |
| `DEGRADED` | Monitorul întâmpină probleme |
| `UNKNOWN` | Starea monitorului nu poate fi determinată |

## Obține monitoarele

Poți folosi acest endpoint ca să găsești și să parcurgi lista tuturor monitoarelor existente.

**Endpoint:**

```bash
GET /:page_id/monitors
```

**Parametri de query**

| Parametru | Tip | Valoare implicită | Descriere |
| --------- | -------- | ------------- | ------------------------------------------------------ |
| `page` | `number` | `1` | Numărul paginii de preluat. |
| `limit` | `number` | `100` | Numărul de monitoare pe pagină. |
| `search` | `string` | `null` | Termen de căutare pentru filtrarea rezultatelor. |
| `status` | `enum` | `null` | Filtru de stare _('UP', 'DOWN', 'UNKNOWN', 'DEGRADED')_. |

**Exemplu de cerere**

```bash
GET /1/monitors?limit=3&page=2&status=DOWN
```

**Exemplu de răspuns**

```json
{
  "monitors": [{ "...": "monitor objects" }],
  "total": 10,
  "page": 3,
  "totalPages": 5,
  "limit": 2
}
```

## Creează un monitor

**Endpoint:**

```bash
POST /monitors
```

**Exemplu de cerere**

```json
{
  "pageId": "page123",
  "url": "https://example.com",
  "httpMethod": "GET",
  "body": null,
  "headers": {
    "Content-Type": "application/json",
    "Authorization": "Bearer token"
  },
  "queryParams": {
    "search": "test",
    "limit": "10"
  },
  "basicAuth": {
    "username": "user",
    "password": "password"
  },
  "type": "HTTP",
  "assertions": [
    {
      "type": "STATUSCODE",
      "comparison": "EQUALS",
      "selector": null,
      "target": "200"
    }
  ],
  "alerts": ["alert-id-1", "alert-id-2"],
  "name": "Example Monitor",
  "locations": "US_EAST_1",
  "checksInterval": 300,
  "createComponent": true,
  "createMetric": true,
  "onFail": {
    "createIncident": true,
    "createOutageDuration": true,
    "publishIncident": true,
    "notifySubscribers": true
  },
  "onRecover": {
    "resolveIncident": true,
    "resolveOutageDuration": true,
    "publishIncident": true,
    "notifySubscribers": true
  }
}
```

**Exemplu de răspuns**

```json
{
  "monitor": {
    "pageId": "page123",
    "url": "https://example.com",
    "httpMethod": "GET",
    "body": null,
    "headers": {
      "Content-Type": "application/json",
      "Authorization": "Bearer token"
    },
    "queryParams": {
      "search": "test",
      "limit": "10"
    },
    "basicAuth": {
      "username": "user",
      "password": "password"
    },
    "type": "HTTP",
    "assertions": [
      {
        "id": "assertion1",
        "type": "STATUSCODE",
        "comparison": "EQUALS",
        "selector": null,
        "target": "200"
      }
    ],
    "alerts": ["alert1", "alert2"],
    "name": "Example Monitor",
    "locations": "US_EAST_1",
    "checksInterval": 300,
    "createComponent": true,
    "createMetric": true,
    "onFail": {
      "createIncident": true,
      "createOutageDuration": true,
      "publishIncident": true,
      "notifySubscribers": true
    },
    "onRecover": {
      "resolveIncident": true,
      "resolveOutageDuration": true,
      "publishIncident": true,
      "notifySubscribers": true
    },
    "createdAt": "2023-08-08T12:00:00Z",
    "updatedAt": "2023-08-08T12:00:00Z"
  },
  "message": "Monitor created successfully"
}
```

## Actualizează un monitor

**Endpoint:**

```bash
PUT /monitors/:id
```

**Exemplu de cerere**

```json
{
  "url": "https://updated.com",
  "name": "Updated Monitor Name"
}
```

**Exemplu de răspuns**

```json
{
  "monitor": {
    "pageId": "page123",
    "url": "https://updated.com",
    "httpMethod": "GET",
    "body": null,
    "headers": {
      "Content-Type": "application/json",
      "Authorization": "Bearer token"
    },
    "queryParams": {
      "search": "test",
      "limit": "10"
    },
    "basicAuth": {
      "username": "user",
      "password": "password"
    },
    "type": "HTTP",
    "assertions": [
      {
        "id": "assertion1",
        "type": "STATUSCODE",
        "comparison": "EQUALS",
        "selector": null,
        "value": "200"
      }
    ],
    "alerts": ["alert1", "alert2"],
    "name": "Updated Monitor Name",
    "locations": "US_EAST_1",
    "checksInterval": 300,
    "createComponent": true,
    "createMetric": true,
    "onFail": {
      "createIncident": true,
      "createOutageDuration": true,
      "publishIncident": true,
      "notifySubscribers": true
    },
    "onRecover": {
      "resolveIncident": true,
      "resolveOutageDuration": true,
      "publishIncident": true,
      "notifySubscribers": true
    },
    "createdAt": "2023-08-08T12:00:00Z",
    "updatedAt": "2023-08-08T12:00:00Z"
  },
  "message": "Monitor updated successfully"
}
```

## Șterge un monitor

**Endpoint:**

```bash
DELETE /monitors/:id
```

**Exemplu de cerere**

```bash
DELETE /monitors/monitor-id-1
```

**Exemplu de răspuns**

```json
{
  "message": "Monitor deleted successfully."
}
```

## Obține jurnalele monitorului

**Endpoint:**

```bash
GET /monitors/:id/logs
```

# Parametri de query

| Parametru | Tip | Valoare implicită | Descriere |
| ---------------------- | --------------------------------------- | --------------- | --------------------------------------------------------------------------------------- |
| `limit` | `number` | 100 | Numărul de elemente pe pagină. Nu poate depăși 1000. |
| `page` | `number` | 1 | Numărul paginii de preluat. |
| `monitorId` | `string` | - | ID-ul monitorului. |
| `location` | `string` | `null` | Locația monitorului. |
| `createdAt` | `string` \| `object` \| `number` | `null` | Data creării. Poate fi un șir, un număr sau un obiect cu câmpurile `gte` și `lte`. |
| `isSuccessful` | `boolean` | `null` | Dacă verificarea a reușit. |
| `isSSLCheck` | `boolean` | `null` | Dacă verificarea este una SSL. |
| `httpStatusCode` | `string` | `null` | Codul de stare HTTP al răspunsului. |
| `status` | `('UP', 'DOWN', 'UNKNOWN', 'DEGRADED')` | `null` | Starea monitorului. |
| `dnsTime` | `string` \| `number` \| `object` | `null` | Timpul necesar pentru rezolvarea DNS. |
| `tcpTime` | `string` \| `number` \| `object` | `null` | Timpul necesar pentru conexiunea TCP. |
| `tlsTime` | `string` \| `number` \| `object` | `null` | Timpul necesar pentru handshake-ul TLS. |
| `firstByteTime` | `string` \| `number` \| `object` | `null` | Timpul până la primirea primului octet. |
| `downloadTime` | `string` \| `number` \| `object` | `null` | Timpul necesar pentru descărcare. |
| `responseTime` | `string` \| `number` \| `object` | `null` | Timpul total de răspuns. |
| `performanceTime` | `string` \| `number` \| `object` | `null` | Timpul de performanță. |
| `accessabilityScore` | `string` \| `number` \| `object` | `null` | Scorul de accesibilitate. |
| `seoScore` | `string` \| `number` \| `object` | `null` | Scorul SEO. |
| `bestPracticesScore` | `string` \| `number` \| `object` | `null` | Scorul pentru bune practici. |
| `successfulAssertions` | `string` \| `number` \| `object` | `null` | Numărul verificărilor reușite. |
| `sort` | `string` | cronologic | Câmpul după care se sortează. |

**Exemplu de cerere**

```bash
GET /monitors/monitor-id-1/logs?limit=100&page=1
```

**Exemplu de răspuns**

```json
{
  "monitorLogs": [
    // {monitor log object},
    // {monitor log object 2}
  ],
  "total": 478,
  "page": 1,
  "totalPages": 5,
  "limit": 100
}
```

## Rulează verificarea unui monitor după ID

**Endpoint:**

```bash
GET /monitors/:id/run
```

**Parametri de query**

| Parametru | Tip | Valoare implicită | Descriere |
| -------------- | --------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------- |
| `location` | `'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'` | - | Locația monitorului. Trebuie să fie una dintre valorile indicate. |
| `retry` | `boolean` | `false` | Indică dacă operațiunea trebuie reîncercată. Opțional. |
| `monitorLogId` | `string` | `null` | Identificatorul unic al jurnalului monitorului. Opțional. |

**Exemplu de cerere**

```bash
GET /monitors/monitor-id-1/run?monitorId=abc123&location=US_EAST_1&retry=true&monitorLogId=log456
```

**Exemplu de răspuns**

```json
{
  "status": "success",
  "message": "Monitor check run successfully."
}
```

## Creează o alertă de monitor

**Endpoint:**

```bash
POST /monitor-alerts
```

**Exemplu de cerere**

```json
{
  "type": "EMAIL",
  "pageId": "page123",
  "recipient": "user@example.com",
  "recipientWorkspace": "workspace123",
  "whenFails": true,
  "whenRecovers": true,
  "whenDegrades": false,
  "whenSslExpires": true,
  "sslExpiresInDays": 30,
  "monitors": ["monitor1", "monitor2"],
  "metadata": "Additional information about the alert"
}
```

**Exemplu de răspuns**

```json
{
  "monitor": {
    "id": "alert123",
    "siteId": "site123",
    "type": "EMAIL",
    "recipient": "user@example.com",
    "whenFails": true,
    "whenRecovers": true,
    "whenDegrades": false,
    "whenSslExpires": true,
    "sslExpiresInDays": 30,
    "monitors": [{ "id": "monitor1" }, { "id": "monitor2" }],
    "createdAt": "2023-08-08T12:00:00Z",
    "updatedAt": "2023-08-08T12:00:00Z",
    "metadata": "Additional information about the alert"
  },
  "message": "Monitor Alert created successfully"
}
```

## Actualizează o alertă de monitor

**Endpoint:**

```bash
PUT /monitor-alerts/:id
```

**Exemplu de cerere**

```json
{
  "type": "EMAIL",
  "monitors": ["monitor-1-id", "monitor-2-id", "monitor-3-id"]
}
```

**Exemplu de răspuns**

```json
{
  "monitor": {
    "type": "EMAIL",
    "pageId": "page123",
    "recipient": "user@example.com",
    "recipientWorkspace": "workspace123",
    "whenFails": true,
    "whenRecovers": true,
    "whenDegrades": false,
    "whenSslExpires": true,
    "sslExpiresInDays": 30,
    "monitors": ["monitor-1-id", "monitor-2-id"],
    "metadata": "Additional information about the alert"
  },
  "message": "Monitor alert updated successfully."
}
```

## Obține alertele monitoarelor

**Endpoint:**

```bash
GET /:page_id/monitor-alerts
```

**Parametri de query**

| Parametru | Tip | Valoare implicită | Descriere |
| --------- | -------- | ------------- | ----------------------------- |
| `limit` | `number` | 100 | Numărul de elemente pe pagină. |
| `page` | `number` | 1 | Numărul paginii de preluat. |

**Exemplu de cerere**

```bash
GET /1/monitor-alerts?limit=2&page=3
```

**Exemplu de răspuns**

```json
{
  "monitorAlerts": [
    {...monitor alert objects}
  ],
  "total": 27,
  "page": 3,
  "totalPages": 14,
  "limit": 2
}
```

## Șterge o alertă de monitor

**Endpoint:**

```bash
DELETE /monitor-alerts/:id
```

**Exemplu de cerere**

```bash
DELETE /monitor-alerts/alert-id-1
```

**Exemplu de răspuns**

```json
{
  "message": "Monitor alert deleted successfully."
}
```

## Creează un grup de monitoare

**Endpoint:**

```bash
POST /monitors-groups
```

**Exemplu de cerere**

```json
{
  "pageId": "page123",
  "name": "Example Name",
  "childId": "child456"
}
```

**Exemplu de răspuns**

```json
{
  "monitor": {
    "id": "group123",
    "name": "Example Name",
    "siteId": "site123",
    "collapsed": false,
    "monitors": [{ "id": "monitor1" }, { "id": "monitor2" }],
    "groupId": "parentGroup123",
    "children": [
      { "id": "childGroup1", "name": "Child Group 1" },
      { "id": "childGroup2", "name": "Child Group 2" }
    ],
    "order": 1,
    "createdAt": "2023-08-08T12:00:00Z",
    "updatedAt": "2023-08-08T12:00:00Z",
    "parents": ["parent1", "parent2"],
    "componentId": "component123"
  },
  "message": "Monitor group created successfully."
}
```

## Actualizează un grup de monitoare

**Endpoint:**

```bash
PUT /monitors-groups/:id
```

**Exemplu de cerere**

```json
{
  "name": "Updated Monitor Group Name"
}
```

**Exemplu de răspuns**

```json
{
  "monitor": {
    "id": "group123",
    "name": "Updated Monitor Group Name",
    "siteId": "site123",
    "collapsed": true,
    "monitors": [{ "id": "monitor1" }, { "id": "monitor2" }],
    "groupId": "parentGroup123",
    "children": [
      { "id": "childGroup1", "name": "Child Group 1" },
      { "id": "childGroup2", "name": "Child Group 2" }
    ],
    "order": 1,
    "createdAt": "2023-08-08T12:00:00Z",
    "updatedAt": "2023-08-08T12:00:00Z",
    "parents": ["parent1", "parent2"],
    "componentId": "component123"
  },
  "message": "Monitor group updated successfully."
}
```

## Șterge un grup de monitoare

**Endpoint:**

```bash
DELETE /monitors-groups/:id
```

**Exemplu de cerere**

```bash
DELETE /monitors-groups/group-id-1
```

**Exemplu de răspuns**

```json
{
  "message": "Monitor group deleted successfully."
}
```

## Adaugă monitoare într-un grup

**Endpoint:**

```bash
POST /monitors-groups/:id/monitors
```

**Exemplu de cerere**

```json
{
  "monitors": ["monitor1", "monitor2", "monitor3"]
}
```

**Exemplu de răspuns**

```json
{
  "message": "Monitors added to the group successfully."
}
```

## Rulează verificarea unui grup de monitoare

**Endpoint:**

```bash
GET /monitors-groups/:id/run
```

**Parametri de query**

| Parametru | Tip | Valoare implicită | Descriere |
| -------------- | --------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------- |
| `location` | `'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'` | - | Locația monitorului. Trebuie să fie una dintre valorile indicate. |
| `retry` | `boolean` | `false` | Indică dacă operațiunea trebuie reîncercată. Opțional. |
| `monitorLogId` | `string` | `null` | Identificatorul unic al jurnalului monitorului. Opțional. |

**Exemplu de cerere**

```bash
GET /monitors-groups/group-id-1/run
```

**Exemplu de răspuns**

```json
{
  "result": "OK",
  "monitorLogId": "monitor-log-id-1"
}
```

## Monitoare cron

Monitoarele cron urmăresc sarcinile programate prin pinguri HTTP. Pentru configurarea în produs și folosirea din panou, vezi [Monitorizarea cron](https://instatus.com/help/ro/monitoring/cron).

### Valori posibile pentru câmpuri

**Starea monitorului cron**

| Valoare | Descriere |
| ---------- | --------------------------------- |
| `UP` | Monitorul funcționează normal |
| `DOWN` | Monitorul a căzut |
| `DEGRADED` | Monitorul întâmpină probleme |
| `UNKNOWN` | Starea monitorului nu poate fi determinată |

**Regimul monitorului cron**

| Valoare | Descriere |
| -------- | ------------------------------------ |
| `ACTIVE` | Monitorul este verificat activ |
| `PAUSED` | Verificările monitorului sunt pe pauză |
| `MUTED` | Monitorul este pus pe silențios (fără notificări) |

**Starea jurnalului monitorului cron**

| Valoare | Descriere |
| --------- | ------------------------------------------------ |
| `SUCCESS` | Sarcina s-a încheiat cu succes |
| `FAILURE` | Sarcina a raportat explicit un eșec |
| `MISSED` | Sarcina nu a făcut ping în fereastra așteptată |
| `LATE` | Sarcina a făcut ping după perioadă, dar în intervalul de toleranță |
| `STARTED` | Sarcina a raportat că a pornit (măsurarea execuției) |

**Perioadă și toleranță**

Atât `period`, cât și `grace` se exprimă în **secunde**. `period` este cât de des ar trebui să ruleze sarcina; `grace` este timpul suplimentar permis înainte ca monitorul să fie marcat ca nefuncțional.

### Obține monitoarele cron

**Endpoint:**

```bash
GET /:page_id/monitors/cron
```

**Parametri de query**

| Parametru | Tip | Valoare implicită | Descriere |
| --------- | -------- | ------------- | ------------------------------------------------------ |
| `limit` | `number` | `100` | Numărul de monitoare cron pe pagină. Maximul este 100. |
| `page` | `number` | `1` | Numărul paginii. |
| `search` | `string` | `null` | Termen de căutare pentru filtrarea rezultatelor după nume. |
| `status` | `enum` | `null` | Filtru de stare _('UP', 'DOWN', 'UNKNOWN', 'DEGRADED')_. |

**Exemplu de cerere**

```bash
GET /page123/monitors/cron?limit=10&page=1&status=DOWN
```

**Exemplu de răspuns**

```json
{
  "cronMonitors": [
    {
      "id": "cron-abc123",
      "name": "Daily backup",
      "slug": "my-page-x7k2m9n4p1q8w3e5",
      "period": 86400,
      "grace": 3600,
      "status": "UP",
      "state": "ACTIVE",
      "siteId": "page123",
      "order": 1,
      "groupId": null,
      "componentId": "component-id-1",
      "onFailCreateIncident": true,
      "onFailCreateOutageDuration": false,
      "onFailPublishIncident": true,
      "onFailNotifySubscribers": true,
      "onRecoverResolveIncident": true,
      "onRecoverResolveOutageDuration": false,
      "onRecoverPublishIncident": true,
      "onRecoverNotifySubscribers": true,
      "createTemplateId": null,
      "resolveTemplateId": null,
      "createdAt": "2024-01-15T08:00:00.000Z",
      "updatedAt": "2024-01-15T08:00:00.000Z"
    }
  ],
  "total": 1,
  "page": 1,
  "totalPages": 1,
  "limit": 10
}
```

### Creează un monitor cron

**Endpoint:**

```bash
POST /monitors/cron
```

**Exemplu de cerere**

```json
{
  "pageId": "page123",
  "name": "Daily backup",
  "period": 86400,
  "grace": 3600,
  "alerts": ["alert-id-1", "alert-id-2"],
  "createComponent": true,
  "onFail": {
    "createIncident": true,
    "createOutageDuration": false,
    "publishIncident": true,
    "notifySubscribers": true
  },
  "onRecover": {
    "resolveIncident": true,
    "resolveOutageDuration": false,
    "publishIncident": true,
    "notifySubscribers": true
  }
}
```

**Exemplu de răspuns**

```json
{
  "cronMonitor": {
    "id": "cron-abc123",
    "name": "Daily backup",
    "slug": "my-page-x7k2m9n4p1q8w3e5",
    "period": 86400,
    "grace": 3600,
    "status": "UP",
    "state": "ACTIVE",
    "siteId": "page123",
    "order": 1,
    "groupId": null,
    "componentId": "component-id-1",
    "onFailCreateIncident": true,
    "onFailCreateOutageDuration": false,
    "onFailPublishIncident": true,
    "onFailNotifySubscribers": true,
    "onRecoverResolveIncident": true,
    "onRecoverResolveOutageDuration": false,
    "onRecoverPublishIncident": true,
    "onRecoverNotifySubscribers": true,
    "createTemplateId": null,
    "resolveTemplateId": null,
    "createdAt": "2024-01-15T08:00:00.000Z",
    "updatedAt": "2024-01-15T08:00:00.000Z"
  },
  "message": "Cron monitor created successfully."
}
```

Răspunsul include un `slug`. Folosește-l ca să construiești URL-urile de ping pentru sarcina ta. Primul ping reușit programează sarcina de verificare din fundal.

### Actualizează un monitor cron

**Endpoint:**

```bash
PUT /monitors/cron/:id
```

**Exemplu de cerere**

```json
{
  "name": "Daily backup (updated)",
  "period": 43200,
  "grace": 1800,
  "state": "PAUSED",
  "alerts": ["alert-id-1"],
  "onFail": {
    "notifySubscribers": false
  }
}
```

**Exemplu de răspuns**

```json
{
  "cronMonitor": {
    "id": "cron-abc123",
    "name": "Daily backup (updated)",
    "slug": "my-page-x7k2m9n4p1q8w3e5",
    "period": 43200,
    "grace": 1800,
    "status": "UP",
    "state": "PAUSED",
    "siteId": "page123",
    "order": 1,
    "groupId": null,
    "componentId": "component-id-1",
    "onFailCreateIncident": true,
    "onFailCreateOutageDuration": false,
    "onFailPublishIncident": true,
    "onFailNotifySubscribers": false,
    "onRecoverResolveIncident": true,
    "onRecoverResolveOutageDuration": false,
    "onRecoverPublishIncident": true,
    "onRecoverNotifySubscribers": true,
    "createTemplateId": null,
    "resolveTemplateId": null,
    "alerts": [
      {
        "id": "alert-id-1",
        "type": "EMAIL",
        "recipient": "ops@example.com"
      }
    ],
    "createdAt": "2024-01-15T08:00:00.000Z",
    "updatedAt": "2024-01-16T10:30:00.000Z"
  },
  "message": "Cron monitor updated successfully."
}
```

### Șterge un monitor cron

**Endpoint:**

```bash
DELETE /monitors/cron/:id
```

**Exemplu de cerere**

```bash
DELETE /monitors/cron/cron-abc123
```

**Exemplu de răspuns**

```json
{
  "cronMonitor": {
    "id": "cron-abc123",
    "name": "Daily backup",
    "slug": "my-page-x7k2m9n4p1q8w3e5",
    "period": 86400,
    "grace": 3600,
    "status": "UP",
    "state": "ACTIVE",
    "siteId": "page123",
    "order": 1,
    "groupId": null,
    "componentId": "component-id-1",
    "onFailCreateIncident": true,
    "onFailCreateOutageDuration": false,
    "onFailPublishIncident": true,
    "onFailNotifySubscribers": true,
    "onRecoverResolveIncident": true,
    "onRecoverResolveOutageDuration": false,
    "onRecoverPublishIncident": true,
    "onRecoverNotifySubscribers": true,
    "createTemplateId": null,
    "resolveTemplateId": null,
    "createdAt": "2024-01-15T08:00:00.000Z",
    "updatedAt": "2024-01-15T08:00:00.000Z"
  },
  "message": "Cron monitor deleted successfully."
}
```

### Obține jurnalele monitorului cron

**Endpoint:**

```bash
GET /monitors/cron/:id/logs
```

**Parametri de query**

| Parametru | Tip | Valoare implicită | Descriere |
| ------------ | -------- | ------------- | -------------------------------------------------------- |
| `limit` | `number` | `100` | Numărul de jurnale pe pagină. Maximul este 127. |
| `page` | `number` | `1` | Numărul paginii. Maximul este 1000. |
| `startDate` | `string` | acum 1 an | Data de început ISO 8601 pentru intervalul jurnalelor. |
| `endDate` | `string` | acum | Data de final ISO 8601 pentru intervalul jurnalelor. |
| `importance` | `enum` | `null` | Filtrează jurnalele după importanță _('all', 'important')_. |

**Exemplu de cerere**

```bash
GET /monitors/cron/cron-abc123/logs?limit=50&page=1&importance=important
```

**Exemplu de răspuns**

```json
{
  "logs": [
    {
      "id": "log-xyz789",
      "monitorId": "cron-abc123",
      "status": "SUCCESS",
      "requestType": "GET",
      "agent": "curl/8.4.0",
      "ipAddress": "203.0.113.10",
      "createdAt": "2024-01-16T06:00:00.000Z",
      "startedAt": "2024-01-16T05:59:58.000Z"
    }
  ],
  "page": 1
}
```

### Obține sumarul monitorului cron

**Endpoint:**

```bash
GET /monitors/cron/:id/summary
```

**Exemplu de cerere**

```bash
GET /monitors/cron/cron-abc123/summary
```

**Exemplu de răspuns**

```json
{
  "summary": {
    "totalLogs": 120,
    "totalFailedLogs": 3,
    "availability": 97.5,
    "oneDayAvailability": 100,
    "previousDayAvailability": 100,
    "sevenDayAvailability": 98.2,
    "previousSevenDayAvailability": 96.1,
    "thirtyDayAvailability": 97.5,
    "previousThirtyDayAvailability": 95.8,
    "lastSuccess": "2024-01-16T06:00:00.000Z",
    "lastFailure": "2024-01-10T06:00:00.000Z",
    "lastStarted": null,
    "upSince": "2024-01-10T07:00:00.000Z",
    "downSince": null
  }
}
```

### Endpointuri de ping

Aceste endpointuri **nu** necesită autentificare. `Slug`-ul monitorului joacă rolul secretului.

Poți face ping prin URL-ul de bază al API-ului sau prin gazda dedicată pentru cron:

- **Succes:** `https://cron.instatus.com/{slug}` sau `GET` / `POST` / `HEAD` `/monitors/cron/{slug}`
- **Eșec:** `https://cron.instatus.com/{slug}/fail` sau `GET` / `POST` / `HEAD` `/monitors/cron/{slug}/fail`
- **Start:** `https://cron.instatus.com/{slug}/start` sau `GET` / `POST` / `HEAD` `/monitors/cron/{slug}/start`

Trimite un ping de succes de fiecare dată când sarcina ta se încheie conform programului. Trimite un ping de start înainte să ruleze sarcina și un ping de succes sau de eșec la finalizare, ca să se înregistreze durata de execuție.

**Exemplu de ping de succes**

```bash
curl https://cron.instatus.com/my-page-x7k2m9n4p1q8w3e5
```

**Exemplu de răspuns**

```json
{
  "id": "log-xyz789",
  "monitorId": "cron-abc123",
  "status": "SUCCESS",
  "requestType": "GET",
  "agent": "curl/8.4.0",
  "ipAddress": "203.0.113.10",
  "createdAt": "2024-01-16T06:00:00.000Z"
}
```

Dacă slug-ul este invalid, răspunsul este:

```json
{
  "message": "Monitor not found"
}
```
