> For the complete documentation index, see [llms.txt](https://api.docs.magloft.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.docs.magloft.com/portal-api/app_pages.md).

# App Pages

API for managing In-App Pages

## List App Pages

<mark style="color:blue;">`GET`</mark> `https://www.magloft.com/api/portal/v1/app_pages/:app_id`

This endpoint **returns** a list of all `app pages` that belong to the magazine

#### Path Parameters

| Name    | Type   | Description                                     |
| ------- | ------ | ----------------------------------------------- |
| app\_id | String | App ID (Publication) to scope this request for. |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "id": 1234,
  "name": "Welcome Letter",
  "title": "Welcome to MagLoft",
  "icon": "trophy",
  "trigger": "on_launch",
  "action": "subscribe",
  "visibility": [
    "web",
    "ios",
    "android"
  ],
  "created_at": "2018-01-24 10:55:35",
  "updated_at": "2018-01-24 10:55:35",
  "published": true,
  "html": "<p>Hello World</p>"
}
```

{% endtab %}
{% endtabs %}

## Retrieve paginated list of readers

<mark style="color:blue;">`GET`</mark> `https://www.magloft.com/api/portal/v1/app_pages/:app_id/page/:page`

This endpoint **returns** a page list of `app pages` that belong to the magazine

#### Path Parameters

| Name    | Type    | Description                                     |
| ------- | ------- | ----------------------------------------------- |
| app\_id | String  | App ID (Publication) to scope this request for. |
| page    | Integer | The page number to list                         |

#### Query Parameters

| Name       | Type    | Description                              |
| ---------- | ------- | ---------------------------------------- |
| per\_page  | Integer | Number of items to show per page         |
| order\_by  | Symbol  | Field to sort results by                 |
| order\_dir | Symbol  | Direction (asc, desc) to sort results by |
| filter     | JSON    |                                          |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "total": 1,
  "page": 1,
  "records": [
    {
      "id": 1234,
      "name": "Welcome Letter",
      "title": "Welcome to MagLoft",
      "icon": "trophy",
      "trigger": "on_launch",
      "action": "subscribe",
      "visibility": [
        "web",
        "ios",
        "android"
      ],
      "created_at": "2018-01-24 10:55:35",
      "updated_at": "2018-01-24 10:55:35",
      "published": true,
      "html": "<p>Hello World</p>"
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Get App Page

<mark style="color:blue;">`GET`</mark> `https://www.magloft.com/api/portal/v1/app_pages/:app_id/:id`

This endpoint **returns** a specific `app page` by `id`

#### Path Parameters

| Name    | Type    | Description                                     |
| ------- | ------- | ----------------------------------------------- |
| app\_id | String  | App ID (Publication) to scope this request for. |
| id      | Integer | App Page ID                                     |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "id": 1234,
  "name": "Welcome Letter",
  "title": "Welcome to MagLoft",
  "icon": "trophy",
  "trigger": "on_launch",
  "action": "subscribe",
  "visibility": [
    "web",
    "ios",
    "android"
  ],
  "created_at": "2018-01-24 10:55:35",
  "updated_at": "2018-01-24 10:55:35",
  "published": true,
  "html": "<p>Hello World</p>"
}
```

{% endtab %}
{% endtabs %}

## Create App Page

<mark style="color:green;">`POST`</mark> `https://www.magloft.com/api/portal/v1/app_pages/:app_id`

This endpoint **creates** a new `app page` and **returns** the saved `app page`

#### Path Parameters

| Name    | Type   | Description                                     |
| ------- | ------ | ----------------------------------------------- |
| app\_id | String | App ID (Publication) to scope this request for. |

#### Request Body

| Name       | Type   | Description                                                                       |
| ---------- | ------ | --------------------------------------------------------------------------------- |
| name       | String | Internal name of a page                                                           |
| title      | String | Visible title of a page                                                           |
| icon       | String | Optional icon to show in the modal window or side menu                            |
| trigger    | String | Trigger Event to specify when the page should show up                             |
| action     | String | Call to action to perform when accepting the offer                                |
| html       | String | The html contents of a page                                                       |
| visibility | Array  | An array specifying on which devices the page should be shown (web, ios, android) |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "id": 1234,
  "name": "Welcome Letter",
  "title": "Welcome to MagLoft",
  "icon": "trophy",
  "trigger": "on_launch",
  "action": "subscribe",
  "visibility": [
    "web",
    "ios",
    "android"
  ],
  "created_at": "2018-01-24 10:55:35",
  "updated_at": "2018-01-24 10:55:35",
  "published": true,
  "html": "<p>Hello World</p>"
}
```

{% endtab %}
{% endtabs %}

## Update App Page

<mark style="color:orange;">`PUT`</mark> `https://www.magloft.com/api/portal/v1/app_pages/:app_id/:id`

This endpoint **updates** a specific `app page` by `id` and **returns** the updated `app page`

#### Path Parameters

| Name    | Type    | Description                                     |
| ------- | ------- | ----------------------------------------------- |
| app\_id | String  | App ID (Publication) to scope this request for. |
| id      | Integer | App Page ID                                     |

#### Request Body

| Name       | Type   | Description                                                                       |
| ---------- | ------ | --------------------------------------------------------------------------------- |
| name       | String | Internal name of a page                                                           |
| title      | String | Visible title of a page                                                           |
| icon       | String | Optional icon to show in the modal window or side menu                            |
| trigger    | String | Trigger Event to specify when the page should show up                             |
| action     | String | Call to action to perform when accepting the offer                                |
| html       | String | The html contents of a page                                                       |
| visibility | Array  | An array specifying on which devices the page should be shown (web, ios, android) |

{% tabs %}
{% tab title="200 " %}

```javascript
{
  "id": 1234,
  "name": "Welcome Letter",
  "title": "Welcome to MagLoft",
  "icon": "trophy",
  "trigger": "on_launch",
  "action": "subscribe",
  "visibility": [
    "web",
    "ios",
    "android"
  ],
  "created_at": "2018-01-24 10:55:35",
  "updated_at": "2018-01-24 10:55:35",
  "published": true,
  "html": "<p>Hello World</p>"
}
```

{% endtab %}
{% endtabs %}

## Delete App Page

<mark style="color:red;">`DELETE`</mark> `https://www.magloft.com/api/portal/v1/app_pages/:app_id/:id`

This endpoint **deletes** a specific `app page` by `id` and **returns** an `empty response` with status `204`

#### Path Parameters

| Name    | Type    | Description                                     |
| ------- | ------- | ----------------------------------------------- |
| app\_id | String  | App ID (Publication) to scope this request for. |
| id      | Integer | App Page ID                                     |

{% tabs %}
{% tab title="204 " %}

```javascript
null
```

{% endtab %}
{% endtabs %}
