# Inbox Feature

Netmera’s REST Inbox API allows you to fetch, display, and manage push notifications stored on the server. It supports pagination, filtering by status or time range, and updating message states (e.g., read, deleted).&#x20;

### Parameters in the Request Body

<table><thead><tr><th width="186.55908203125">Parameter</th><th width="242.59881591796875">Description</th><th width="145.74755859375">Required</th><th>Type</th></tr></thead><tbody><tr><td><code>extId</code></td><td>The unique external ID of the user.</td><td>Yes</td><td><code>String</code></td></tr><tr><td><code>status</code></td><td>Filters the messages based on read status.</td><td>Yes</td><td><code>Integer</code><br>Accepted values:<br>1 = Read<br>2 = Unread<br>3 = Read &#x26; Unread<br>4 = Deleted<br>7 = All</td></tr><tr><td><code>numberOfNotification</code></td><td>Defines the number of messages to return per page. Defaults to 20 if not provided.</td><td>No</td><td><code>Integer</code></td></tr><tr><td><code>prms.index</code></td><td>Used for pagination. Represents the <code>pushInstanceId</code> of the last message received in the previous response.</td><td>No</td><td><code>Long</code></td></tr><tr><td><code>startDate</code></td><td>Filters messages starting from this date. Epoch timestamp in milliseconds.</td><td>No</td><td><code>Long</code></td></tr><tr><td><code>endDate</code></td><td>Filters messages until this date. Epoch timestamp in milliseconds.</td><td>No</td><td><code>Long</code></td></tr><tr><td><code>category</code></td><td>Filters messages by categories.</td><td>No</td><td><code>Array&#x3C;Integer></code></td></tr><tr><td><code>piids</code></td><td>Used in <code>/statusChange</code> to define the messages whose statuses will be updated.</td><td>Yes (for <code>/statusChange</code>)</td><td><code>Array&#x3C;Integer></code></td></tr></tbody></table>

### Inbox Retrieval

**Endpoint**

```json
POST /rest/3.0/inbox/getAllInbox
```

**Sample Request**

```json
curl -X POST https://restapi.netmera.com/rest/3.0/inbox/getAllInbox \
  -H "X-netmera-api-key: your_rest_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "extId": "your_extId",
    "status": 2,
    "startDate": 1681635178000,
    "endDate": 1684227178000,
    "numberOfNotification": 3
}'
```

**Sample Response**

```json
{
  "msgs": [
    {
      "msgId": 25965,
      "pushInstanceId": 3101819,
      "title": "test",
      "message": "Test",
      "status": "UNREAD",
      "sts": 1681635178000,
      "subText": "test"
    }
  ],
  "cnts": {
    "2": 1
  },
  "prms": {
    "index": 3101819
  }
}
```

### Using Pagination (via `prms.index`)

Pagination allows you to retrieve messages in batches. After the first call, the response returns a `prms.index` value – which is the `pushInstanceId` of the last message in that batch. To fetch the **next page**, you must pass this index value in the next request.

#### Pagination Flow Example

**Page 1 – Request**

```json
{
  "extId": "externalid",
  "status": 7,
  "startDate": 1738405578000,
  "endDate": 1740997578000,
  "numberOfNotification": 3
}
```

**Page 1 – Response**

```json
{
  "msgs": [
    { "msgId": 12941, "pushInstanceId": 10758003, "title": "msgtitle", ... },
    { "msgId": 12939, "pushInstanceId": 10758002, "title": "msgtitle", ... },
    { "msgId": 12941, "pushInstanceId": 10742004, "title": "msgtitle", ... }
  ],
  "cnts": { "1": 2, "2": 3, "4": 0 },
  "prms": { "index": 10742004 }
}
```

The `prms.index` value (`10742004`) will be used in the second request to fetch the next page.

**Page 2 – Request**

```json
{
  "extId": "externalid",
  "status": 7,
  "startDate": 1738405578000,
  "endDate": 1740997578000,
  "numberOfNotification": 3,
  "prms": {
    "index": 10742004
  }
}
```

**Page 2 – Response**

```json
{
  "msgs": [
    { "msgId": 12942, "pushInstanceId": 10734004, "title": "msgtitle", ... },
    { "msgId": 12941, "pushInstanceId": 10734003, "title": "msgtitle", ... }
  ],
  "cnts": { "1": 2 }
}
```

### Retrieve a Single Inbox Message

**Endpoint**

```json
GET /rest/3.0/inbox/get?piid={pushInstanceId}
```

**Sample Request**

```json
curl -X GET 'https://restapi.netmera.com/rest/3.0/inbox/get?piid=3103726' \
-H 'X-netmera-api-key: your_rest_api_key' \
-H 'Content-Type: application/json'
```

### Change Message Status

**Endpoint**

```
POST /rest/3.0/inbox/statusChange
```

**Sample Request**

```json
curl -X POST 'https://restapi.netmera.com/rest/3.0/inbox/statusChange' \
-H 'X-netmera-api-key: your_rest_api_key' \
-H 'Content-Type: application/json' \
-d '{
  "extId": "your_extId",
  "piids": [2584151],
  "st": 4
}'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://user.netmera.com/netmera-developer-guide/api-documentation/rest-api/inbox-feature.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
