# מדריך ה‑API של ניטורים

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

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

## ערכים אפשריים לשדות

**מיקום הניטור**

| ערך            | תיאור       |
| ---------------- | ----------------- |
| `US_EAST_1`      | צפון וירג׳יניה       |
| `CA_CENTRAL_1`   | קנדה (מונטריאול) |
| `EU_CENTRAL_1`   | פרנקפורט         |
| `AP_NORTHEAST_1` | טוקיו             |

**סוגי התראות ניטור**

| ערך             | תיאור           |
| ----------------- | --------------------- |
| `INCIDENT`        | התראת תקרית        |
| `EMAIL`           | התראת אימייל           |
| `SMS`             | התראת SMS             |
| `SLACK`           | התראת Slack           |
| `DISCORD`         | התראת Discord         |
| `MICROSOFT_TEAMS` | התראת Microsoft Teams |
| `PHONE_CALL`      | התראה בשיחת טלפון      |
| `WEBHOOK`         | התראת Webhook         |
| `GOOGLE_CHAT`     | התראת Google Chat     |
| `WHATSAPP`        | התראת WhatsApp        |

**סטטוס הניטור**

| ערך      | תיאור                       |
| ---------- | --------------------------------- |
| `UP`       | הניטור פועל כרגיל       |
| `DOWN`     | הניטור נכשל                |
| `DEGRADED` | הניטור חווה תקלות    |
| `UNKNOWN`  | לא ניתן לקבוע את מצב הניטור |

## קבלת ניטורים

אפשר להשתמש בנקודת הקצה הזו כדי למצוא ולעבור על רשימה של כל הניטורים הקיימים.

**נקודת קצה:**

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

**פרמטרי שאילתה**

| פרמטר | סוג     | ברירת מחדל | תיאור                                            |
| --------- | -------- | ------------- | ------------------------------------------------------ |
| `page`    | `number` | `1`           | מספר העמוד לשליפה.                              |
| `limit`   | `number` | `100`         | מספר הניטורים בכל עמוד.                       |
| `search`  | `string` | `null`        | מונח חיפוש לסינון התוצאות.                     |
| `status`  | `enum`   | `null`        | סינון לפי סטטוס _('UP', 'DOWN', 'UNKNOWN', 'DEGRADED')_. |

**דוגמת בקשה**

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

**דוגמת תשובה**

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

## יצירת ניטור

**נקודת קצה:**

```bash
POST /monitors
```

**דוגמת בקשה**

```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
  }
}
```

**דוגמת תשובה**

```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"
}
```

## עדכון ניטור

**נקודת קצה:**

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

**דוגמת בקשה**

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

**דוגמת תשובה**

```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"
}
```

## מחיקת ניטור

**נקודת קצה:**

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

**דוגמת בקשה**

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

**דוגמת תשובה**

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

## קבלת יומני הניטור

**נקודת קצה:**

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

# פרמטרי שאילתה

| פרמטר              | סוג                                    | ברירת מחדל   | תיאור                                                                             |
| ---------------------- | --------------------------------------- | --------------- | --------------------------------------------------------------------------------------- |
| `limit`                | `number`                                | 100             | מספר הפריטים בכל עמוד. אינו יכול לעלות על 1000.                                       |
| `page`                 | `number`                                | 1               | מספר העמוד לשליפה.                                                            |
| `monitorId`            | `string`                                | -               | מזהה הניטור.                                                                  |
| `location`             | `string`                                | `null`          | מיקום הניטור.                                                            |
| `createdAt`            | `string` \| `object` \| `number`        | `null`          | תאריך היצירה. יכול להיות מחרוזת, מספר או אובייקט עם השדות `gte` ו‑`lte`. |
| `isSuccessful`         | `boolean`                               | `null`          | האם הבדיקה הצליחה.                                                       |
| `isSSLCheck`           | `boolean`                               | `null`          | האם הבדיקה היא בדיקת SSL.                                                      |
| `httpStatusCode`       | `string`                                | `null`          | קוד סטטוס ה‑HTTP של התשובה.                                                   |
| `status`               | `('UP', 'DOWN', 'UNKNOWN', 'DEGRADED')` | `null`          | סטטוס הניטור.                                                              |
| `dnsTime`              | `string` \| `number` \| `object`        | `null`          | הזמן שנדרש לפענוח ה‑DNS.                                                          |
| `tcpTime`              | `string` \| `number` \| `object`        | `null`          | הזמן שנדרש לחיבור ה‑TCP.                                                          |
| `tlsTime`              | `string` \| `number` \| `object`        | `null`          | הזמן שנדרש ללחיצת היד של TLS.                                                           |
| `firstByteTime`        | `string` \| `number` \| `object`        | `null`          | הזמן שנדרש לקבלת הבייט הראשון.                                           |
| `downloadTime`         | `string` \| `number` \| `object`        | `null`          | הזמן שנדרש להורדה.                                                            |
| `responseTime`         | `string` \| `number` \| `object`        | `null`          | זמן התגובה הכולל.                                                                    |
| `performanceTime`      | `string` \| `number` \| `object`        | `null`          | זמן הביצועים.                                                                       |
| `accessabilityScore`   | `string` \| `number` \| `object`        | `null`          | ציון הנגישות.                                                                    |
| `seoScore`             | `string` \| `number` \| `object`        | `null`          | ציון ה‑SEO.                                                                              |
| `bestPracticesScore`   | `string` \| `number` \| `object`        | `null`          | ציון שיטות העבודה המומלצות.                                                   |
| `successfulAssertions` | `string` \| `number` \| `object`        | `null`          | מספר הבדיקות שהצליחו.                                                        |
| `sort`                 | `string`                                | כרונולוגי | השדה שלפיו ממיינים.                                                                       |

**דוגמת בקשה**

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

**דוגמת תשובה**

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

## הרצת בדיקת ניטור לפי מזהה

**נקודת קצה:**

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

**פרמטרי שאילתה**

| פרמטר      | סוג                                                                              | ברירת מחדל | תיאור                                                       |
| -------------- | --------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------- |
| `location`     | `'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'` | -             | מיקום הניטור. חייב להיות אחד מהערכים המצוינים. |
| `retry`        | `boolean`                                                                         | `false`       | מציין אם יש לנסות את הפעולה שוב. אופציונלי.      |
| `monitorLogId` | `string`                                                                          | `null`        | המזהה הייחודי של יומן הניטור. אופציונלי.               |

**דוגמת בקשה**

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

**דוגמת תשובה**

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

## יצירת התראת ניטור

**נקודת קצה:**

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

**דוגמת בקשה**

```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"
}
```

**דוגמת תשובה**

```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"
}
```

## עדכון התראת ניטור

**נקודת קצה:**

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

**דוגמת בקשה**

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

**דוגמת תשובה**

```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."
}
```

## קבלת התראות ניטור

**נקודת קצה:**

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

**פרמטרי שאילתה**

| פרמטר | סוג     | ברירת מחדל | תיאור                   |
| --------- | -------- | ------------- | ----------------------------- |
| `limit`   | `number` | 100           | מספר הפריטים בכל עמוד. |
| `page`    | `number` | 1             | מספר העמוד לשליפה.  |

**דוגמת בקשה**

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

**דוגמת תשובה**

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

## מחיקת התראת ניטור

**נקודת קצה:**

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

**דוגמת בקשה**

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

**דוגמת תשובה**

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

## יצירת קבוצת ניטורים

**נקודת קצה:**

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

**דוגמת בקשה**

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

**דוגמת תשובה**

```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."
}
```

## עדכון קבוצת ניטורים

**נקודת קצה:**

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

**דוגמת בקשה**

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

**דוגמת תשובה**

```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."
}
```

## מחיקת קבוצת ניטורים

**נקודת קצה:**

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

**דוגמת בקשה**

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

**דוגמת תשובה**

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

## הוספת ניטורים לקבוצה

**נקודת קצה:**

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

**דוגמת בקשה**

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

**דוגמת תשובה**

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

## הרצת בדיקה לקבוצת ניטורים

**נקודת קצה:**

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

**פרמטרי שאילתה**

| פרמטר      | סוג                                                                              | ברירת מחדל | תיאור                                                       |
| -------------- | --------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------- |
| `location`     | `'US_EAST_1', 'EU_CENTRAL_1', 'AP_NORTHEAST_1', 'AP_SOUTHEAST_2', 'CA_CENTRAL_1'` | -             | מיקום הניטור. חייב להיות אחד מהערכים המצוינים. |
| `retry`        | `boolean`                                                                         | `false`       | מציין אם יש לנסות את הפעולה שוב. אופציונלי.      |
| `monitorLogId` | `string`                                                                          | `null`        | המזהה הייחודי של יומן הניטור. אופציונלי.               |

**דוגמת בקשה**

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

**דוגמת תשובה**

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

## ניטורי Cron

ניטורי Cron עוקבים אחר משימות מתוזמנות באמצעות פינגים ב‑HTTP. להגדרה במוצר ולשימוש בדאשבורד, ראו [ניטור Cron](https://instatus.com/help/he/monitoring/cron).

### ערכים אפשריים לשדות

**סטטוס ניטור Cron**

| ערך      | תיאור                       |
| ---------- | --------------------------------- |
| `UP`       | הניטור פועל כרגיל       |
| `DOWN`     | הניטור נכשל                |
| `DEGRADED` | הניטור חווה תקלות    |
| `UNKNOWN`  | לא ניתן לקבוע את מצב הניטור |

**מצב ניטור Cron**

| ערך    | תיאור                          |
| -------- | ------------------------------------ |
| `ACTIVE` | הניטור נבדק באופן פעיל          |
| `PAUSED` | בדיקות הניטור מושהות            |
| `MUTED`  | הניטור מושתק (ללא התראות)  |

**סטטוס יומן ניטור Cron**

| ערך     | תיאור                                      |
| --------- | ------------------------------------------------ |
| `SUCCESS` | המשימה הושלמה בהצלחה                       |
| `FAILURE` | המשימה דיווחה במפורש על כישלון              |
| `MISSED`  | המשימה לא שלחה פינג בחלון הזמן הצפוי      |
| `LATE`    | המשימה שלחה פינג אחרי המחזור אך בתוך זמן החסד     |
| `STARTED` | המשימה דיווחה שהתחילה (מדידת זמן ריצה)  |

**מחזור וחסד**

גם `period` וגם `grace` מצוינים ב**שניות**. `period` הוא התדירות שבה המשימה אמורה לרוץ; `grace` הוא זמן נוסף שמותר לפני שהניטור מסומן כמושבת.

### קבלת ניטורי Cron

**נקודת קצה:**

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

**פרמטרי שאילתה**

| פרמטר | סוג     | ברירת מחדל | תיאור                                            |
| --------- | -------- | ------------- | ------------------------------------------------------ |
| `limit`   | `number` | `100`         | מספר ניטורי ה‑Cron בכל עמוד. המקסימום הוא 100.  |
| `page`    | `number` | `1`           | מספר העמוד.                                       |
| `search`  | `string` | `null`        | מונח חיפוש לסינון התוצאות לפי שם.             |
| `status`  | `enum`   | `null`        | סינון לפי סטטוס _('UP', 'DOWN', 'UNKNOWN', 'DEGRADED')_. |

**דוגמת בקשה**

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

**דוגמת תשובה**

```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
}
```

### יצירת ניטור Cron

**נקודת קצה:**

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

**דוגמת בקשה**

```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
  }
}
```

**דוגמת תשובה**

```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."
}
```

התשובה כוללת `slug`. השתמשו בו כדי לבנות כתובות פינג עבור המשימה שלכם. הפינג המוצלח הראשון מתזמן את משימת הבדיקה ברקע.

### עדכון ניטור Cron

**נקודת קצה:**

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

**דוגמת בקשה**

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

**דוגמת תשובה**

```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."
}
```

### מחיקת ניטור Cron

**נקודת קצה:**

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

**דוגמת בקשה**

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

**דוגמת תשובה**

```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."
}
```

### קבלת יומני ניטור Cron

**נקודת קצה:**

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

**פרמטרי שאילתה**

| פרמטר    | סוג     | ברירת מחדל | תיאור                                              |
| ------------ | -------- | ------------- | -------------------------------------------------------- |
| `limit`      | `number` | `100`         | מספר היומנים בכל עמוד. המקסימום הוא 127.             |
| `page`       | `number` | `1`           | מספר העמוד. המקסימום הוא 1000.                        |
| `startDate`  | `string` | לפני שנה    | תאריך התחלה בפורמט ISO 8601 לטווח היומנים.                   |
| `endDate`    | `string` | עכשיו           | תאריך סיום בפורמט ISO 8601 לטווח היומנים.                     |
| `importance` | `enum`   | `null`        | סינון היומנים לפי חשיבות _('all', 'important')_.        |

**דוגמת בקשה**

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

**דוגמת תשובה**

```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
}
```

### קבלת סיכום ניטור Cron

**נקודת קצה:**

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

**דוגמת בקשה**

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

**דוגמת תשובה**

```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
  }
}
```

### נקודות קצה לפינג

נקודות הקצה האלה **אינן** דורשות אימות. ה‑`slug` של הניטור משמש כסוד.

אפשר לשלוח פינג דרך כתובת הבסיס של ה‑API או דרך שרת ה‑cron הייעודי:

- **הצלחה:** `https://cron.instatus.com/{slug}` או `GET` / `POST` / `HEAD` `/monitors/cron/{slug}`
- **כישלון:** `https://cron.instatus.com/{slug}/fail` או `GET` / `POST` / `HEAD` `/monitors/cron/{slug}/fail`
- **התחלה:** `https://cron.instatus.com/{slug}/start` או `GET` / `POST` / `HEAD` `/monitors/cron/{slug}/start`

שלחו פינג הצלחה בכל פעם שהמשימה שלכם מסתיימת בזמן. שלחו פינג התחלה לפני שהמשימה רצה ופינג הצלחה או כישלון בסיומה כדי לתעד את זמן הריצה.

**דוגמה לפינג הצלחה**

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

**דוגמת תשובה**

```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"
}
```

אם ה‑slug אינו תקין, התשובה היא:

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