# مرجع API مانیتورها

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

- [Monitors](https://instatus.com/help/fa/api/monitors#get-monitors): Check the uptime of your websites, APIs, and services
- [Cron Monitors](https://instatus.com/help/fa/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` | هشدار پیامکی |
| `SLACK` | هشدار Slack |
| `DISCORD` | هشدار Discord |
| `MICROSOFT_TEAMS` | هشدار Microsoft Teams |
| `PHONE_CALL` | هشدار تماس تلفنی |
| `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 | تعداد آیتم‌ها در هر صفحه. نمی‌تواند از ۱۰۰۰ بیشتر شود. |
| `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/fa/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 در هر صفحه. بیشینه ۱۰۰ است. |
| `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` | تعداد گزارش‌ها در هر صفحه. بیشینه ۱۲۷ است. |
| `page` | `number` | `1` | شماره صفحه. بیشینه ۱۰۰۰ است. |
| `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"
}
```
