# Monitor Task Ad Copy (Longest Running)

## API Information

- **API Name**: Monitor Task Ad Copy (Longest Running)
- **Request Method**: POST
- **API URL**: `open-api/v1/monitor/data`
- **Endpoint Path**: `/v3/api/ad-monitor-task/ad-copy-longest-run`
- **Description**:
    - Get ad copy - longest running list, analyze the continuous delivery duration of ad copies
    - Usage Note: `Free`

**Request Headers:**

- Content-Type: application/json
- Accept: application/json

## Request Parameters

### Request Structure

| Parameter | Type   | Description                       | Example                                | Required | Default |
| --------- | ------ | --------------------------------- | -------------------------------------- | -------- | ------- |
| key       | string | User's external API request key   | "your_api_key_here"                   | Yes      |         |
| uri       | string | Endpoint path                     | "/v3/api/ad-monitor-task/ad-copy-longest-run" | Yes      |         |
| params    | object | Request parameters object         | See parameter list                     | Yes      |         |

### Request Body Parameters (params object)

| Parameter | Type    | Required | Description                              |
|-----------|---------|----------|------------------------------------------|
| task_id   | String  | true     | Task ID                                  |
| order_by  | String  | false    | Sort field<br/>active_days<br/>ad_started_at |
| direction | String  | false    | Sort order<br/>desc(descending)<br/>asc(ascending) |
| page      | integer | false    | Page number (default 1)                  |
| per_page  | integer | false    | Page size (default 10)                   |

### Request Example

```bash
curl -X POST "https://www.pipispy.com/open-api/v1/monitor/data" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json" \
  -d '{
    "key": "your_api_key_here",
    "uri": "/v3/api/ad-monitor-task/ad-copy-longest-run",
    "params": {
      "task_id": "68fa2e36789edb5700215e03",
      "order_by": "active_days",
      "direction": "desc",
      "per_page": 10,
      "page": 1
    }
  }'
```

## Response Parameters

### Response Structure

```json
{
    "code": 200,
    "message": "success",
    "data": {},
    "version": "v1",
    "timestamp": null,
    "sign": null,
  "remaining_credits": 9980,
  "consumed_credits": 0,
    "success": true,
    "fail": false
}
```

### Response Field Description

| Field Name | Type    | Description                     |
| ---------- | ------- | ------------------------------- |
| code       | Integer | Response status code, 200 means success |
| message    | String  | Response message                |
| data       | Object  | Response data                   |
| version    | String  | API version                     |
| timestamp  | String  | Response timestamp              |
| sign       | String  | Response signature              |
| remaining_credits | Long    | Current remaining available credits after this request |
| consumed_credits  | Long    | Credits consumed by this request                       |
| success    | Boolean | Request success status          |
| fail       | Boolean | Request failure status          |

### Response Data Information Fields
#### Pagination Information Fields
| Field Name   | Type     | Description       |
|--------------|----------|-------------------|
| per_page     | integer  | Items per page    | 
| total        | integer  | Total records     | 
| last_page    | integer  | Last page number  | 
| current_page | integer  | Current page number | 

#### Ad Copy Data Fields (objects in data array)
| Field Name   | Type     | Description                               |
|--------------|----------|-------------------------------------------|
| ad_id        | string   | Ad unique identifier ID                   | 
| ad_content   | string   | Ad copy content                           | 
| ad_started_at| integer  | Ad start delivery timestamp (seconds)     | 
| active_days  | integer  | Ad active days                            | 
| ad_status    | integer  | Ad status (1:Active, 2:Inactive, 3:Removed) | 
| media_format | integer  | Media format (1:Video, 2:Image, 3:Carousel) | 

#### Carousel Card Information Fields (objects in cards array)
| Field Name  | Type     | Description                          |
|-------------|----------|--------------------------------------|
| cover_url   | string   | Card cover image URL                 | 
| media_type  | integer  | Media type (1:Video, 2:Image)       | 
| url         | string   | Media file URL (video or image)     | 

## Response Example

```json
{
  "code": 200,
  "message": "success",
  "data": {
    "per_page": 1,
    "total": 14383,
    "data": [
      {
        "ad_id": "533113862830147",
        "cards": [
          {
            "cover_url": "https://cdn.pipidata.com/images/9192627b9a36040a50fe2de4b498af66bd5dbd6eba3105319e6741143ef98ad3.png",
            "media_type": 1,
            "url": "https://cdn.pipidata.com/videos/5fa61671bec84b95fc8c89b2d6b1c1c2b32b645cdd52a5d518e6e2df13a6e5d8.mp4"
          },
          {
            "cover_url": "https://cdn.pipidata.com/images/b580a01a2b3c53582c0973c76435745b4bc98c1a9aa5d02a85c1ba1d8fff06eb.png",
            "media_type": 1,
            "url": "https://cdn.pipidata.com/videos/39716ecc4d74112db9bbb9cd39ebc574548a3c335afd3dffdf61adff689089cf.mp4"
          },
          {
            "cover_url": "https://cdn.pipidata.com/images/8a01532735407f02653e6bcf2614ede57378f2489993f524a4411187e0ce85af.png",
            "media_type": 1,
            "url": "https://cdn.pipidata.com/videos/c79d0d74990f35d70b3a454d393f69267fba3b51f62ccd78baaea086f22cb602.mp4"
          },
          {
            "cover_url": "https://cdn.pipidata.com/images/1aed919d9871dcfef51b68b063ca8ee901e59a869319a51e3a71f408d5928fe0.png",
            "media_type": 1,
            "url": "https://cdn.pipidata.com/videos/77448e042c5babe93bddbd63b09e147f87d89f48dced4f62545003768dfdc48b.mp4"
          },
          {
            "cover_url": "https://cdn.pipidata.com/images/46a27759af20e2be7870263f781eb8c0077440d62242eb798abc7b19eac271db.png",
            "media_type": 1,
            "url": "https://cdn.pipidata.com/videos/ee1162127729f52b9943234cbf23f8c67cec59a2956d183bb83d88e9d4e88716.mp4"
          }
        ],
        "media_format": 3,
        "ad_content": "Werken bij Coolblue",
        "ad_started_at": 1731916800,
        "active_days": 184,
        "ad_status": 1
      }
    ],
    "last_page": 14383,
    "current_page": 1
  },
  "version": "v1",
  "timestamp": null,
  "sign": null,
  "remaining_credits": 9980,
  "consumed_credits": 0,
  "success": true,
  "fail": false
}
```

## Error Codes

| Error Code | Description           |
| ---------- | --------------------- |
| 200        | Success               |
| 400        | Invalid request parameters |
| 500        | Internal server error |
