# Local Library Data Interface

> **Note:** The local library data interface is independent of the client and operates completely separately. It is a standalone logging system. The recorded data can be viewed on the “Operation Log > Local Library Data” page and can also be queried using the API. This feature helps script authors and users in logging custom data, or can serve as a simple local database.

### Paginated Query of Log List

**POST**: `/extralog/list`

```json
// Example of request body
{
  "page": 0,
  "page_size": 10,
  "search_key": "",
  "search_value": "",
  "order_by": "desc"
}
```

* Parameter Details

| Parameter     | Type   | Required | Description                                                           |
| ------------- | ------ | -------- | --------------------------------------------------------------------- |
| page          | int    | Yes      | Page number, starting from 0                                          |
| page\_size    | int    | Yes      | Number of records per page, default is 10                             |
| search\_key   | string | Yes      | Search field, specific fields refer to the add interface              |
| search\_value | string | Yes      | Search value for the field, performs fuzzy search based on this value |
| order\_by     | string | No       | Sorting parameter, default is by id, options: desc or asc ｜ asc       |

### Add Log

**POST**: `/extralog/add`

```json
// Example of request body
{
  "log_key": "666",
  "log_name": "i am name",
  "log_value": "de333f",
  "log_type": "Browser",
  "log_desc": "i am a desc",
  "log_remark": "remark",
  "log_extra_info": "Custom info content, can store serialized structured data like stringified JSON"
}
```

* Parameter Details

| Parameter        | Type   | Required | Description                                                                                   |
| ---------------- | ------ | -------- | --------------------------------------------------------------------------------------------- |
| log\_name        | string | Yes      | Custom name name                                                                              |
| log\_key         | string | Yes      | Custom key, allows the user to generate a unique key for each record, making it easier to use |
| log\_type        | string | Yes      | Custom type, logs can be categorized for easier searching                                     |
| log\_value       | string | Yes      | Custom value, can be used for storing values or other data                                    |
| log\_desc        | string | No       | Custom description desc                                                                       |
| log\_remark      | string | No       | Custom remark remark                                                                          |
| log\_extra\_info | string | No       | Custom info content, can store serialized structured data like stringified JSON               |

### Update Log

The update interface fields are the same as the add interface. You must include the id field, and only the fields that need to be modified should be provided. There is no need to pass all fields.

```json
// Example of request body
{
  "id": 122,
  "log_name": "I'm log name"
}
```

* Parameter Details

| Parameter | Type   | Required | Description                                         |
| --------- | ------ | -------- | --------------------------------------------------- |
| id        | int    | Yes      | Record ID                                           |
| ...       | string | No       | Other fields are the same as in the Add Log section |

### Delete Log

**POST**: `/extralog/delete`

```json
// Example of request body
{
  "id": 12
}
```

### Get Log Details

**POST**: `/extralog/detail`

````json
// Example of request body
{
  "id": 12,
  "name": "dsds"
}

```
// 返回详情数据示例
{
  "success": true,
  "data": {
    "id": 8,
    "log_username": "username",
    "log_userid": "3dsd3dsdd3dsdsdssds3dsssddsdsd",
    "created_time": "2024-07-03 10:11:32",
    "log_name": "i am name",
    "log_key": "33",
    "log_type": "Browser",
    "log_value": "Log value",
    "log_desc": "i am a desc",
    "log_remark": "remark",
    "log_extra_info": "0.0"
}
}
````

### Clear All Log Records (No Parameters)

> **Warning:** This interface will clear all local log data. This action cannot be undone, so use it with caution.

**POST**: `/extralog/clear`


---

# 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://doc.bitbrowser.net/api-docs/local-library-data-interface.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.
