# Update Device Activity

**Important Note:**

If the value of `device_management` is set to 1, which means that the system is enabled. This configuration is obtained from the server at the endpoint `/api/base/configs`. The system will remain enabled until you explicitly disable it.

On the other hand, if the value  `device_management` is anything other than 1, the system is considered disabled.

To provide a seamless user experience, it is essential to handle the error message display only when the `device_banned` status code is received. In all other cases, no error code should impact the user experience. Prioritizing a smooth user interaction, avoid unnecessary interruptions or error messages for non-banned devices.

Furthermore, to maintain an uninterrupted user experience, verifying that the device has an active internet connection is recommended before sending these requests. If the internet is not connected, refrain from sending these requests to prevent any adverse effects on the user experience.

#### API Route

`{{apiBase}}/v2/device_activity`

#### Request

* Method: POST

**Parameters**

| Parameter        | Type    | Description                                                                                                   |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------- |
| `mac_address`    | String  | Required. The unique identifier of the device.                                                                |
| `content_id`     | Integer | Required for some screens. The ID of the content that is currently being displayed or played on the device.   |
| `content_type`   | Integer | Required for some screens. The type of the content that is currently being displayed or played on the device. |
| `current_screen` | String  | Required. The current screen of the device. This value must be one of the predefined values.                  |

Here are the accepted `current_screen` values, their respective requirements for `content_id` and `content_type`, when to trigger the endpoint, and the possible `content_type` values:

| Current Screen       | Content ID & Type Required | When to Trigger                                                                         |
| -------------------- | -------------------------- | --------------------------------------------------------------------------------------- |
| `home`               | No                         | When the user is on the home screen                                                     |
| `content_info`       | Yes                        | When the user is viewing the information about a specific content (movie, series, etc.) |
| `livetv`             | Yes                        | When the user is viewing live TV                                                        |
| `epg`                | Yes                        | When the user is viewing the Electronic Program Guide (EPG)                             |
| `content_list`       | No                         | When the goes to content list in left menu or clicks on view all                        |
| `content_list_group` | Yes                        | When the goes to content list group in left menu                                        |
| `search`             | No                         | When the user is in the search screen                                                   |
| `my_list`            | No                         | When the user is viewing their personal list of contents                                |
| `help`               | No                         | When the user is on the help screen                                                     |
| `player`             | Yes                        | When the user is playing a specific content (movie, series, etc.)                       |
| `movie_category`     | Yes                        | When the user is browsing a movie category                                              |
| `series_category`    | Yes                        | When the user is browsing a series category                                             |
| `all_movies`         | No                         | When the user is viewing all available movies in spotlight                              |
| `all_series`         | No                         | When the user is viewing all available series in spotlight                              |

`content_type` values:

| Value | Label              |
| ----- | ------------------ |
| 1     | Movie              |
| 2     | Series             |
| 3     | Episode            |
| 4     | Live               |
| 5     | Trailer            |
| 8     | Category           |
| 13    | Content List Group |

**Usage Example**

```json
{
    "mac_address": "A1B2C3D4E5F6",
    "content_id": 2018,
    "content_type": 1,
    "current_screen": "movie_player"
}
```

#### Success Response

* Status: 200
* Description: Indicates that the device activity was updated successfully.
* Body: The response body contains the updated device activity details in JSON format.

```json
{
    "status": 200,
    "timestamp": 1684581679,
    "time": 0.598,
    "ip": "127.0.0.1",
    "message": "Success",
    "data": {...}
}
```

#### Error Response

* Status: 400
* Description: Indicates an error occurred during the device activity update.
* Body: The response body provides information about the specific error that occurred.

**Device Not Found**

If you receive the error code `device_not_found`, make the "add device" call first.

```json
{
    "status": 400,
    "timestamp": 1684581704,
    "time": 0.56,
    "ip": "127.0.0.1",
    "message": "Device not found",
    "error_code": "device_not_found",
    "data": []
}

```


---

# 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://docs.vodlix.com/developer-guide/api-documentation/device-management/update-device-activity.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.
