# Hạn sử dụng sản phẩm

* /api/product/expire: Tính năng này dùng để lấy hạn sử dụng sản phẩm ở trên Nhanh.vn. Dữ liệu sẽ được phân trang, mỗi trang tối đa không quá 50 sản phẩm.

## Request

* Xem các [common request params](/v2/readme.md#request-params)
* Các key của mảng **data array** dùng để tạo **data** json string:

| Key                | Type             | Description                                                                                      |
| ------------------ | ---------------- | ------------------------------------------------------------------------------------------------ |
| page               | int              | Phân trang, giá trị mặc định sẽ là 1.                                                            |
| icpp               | int              | Số lượng sản phẩm trên 1 trang. Tối đa không quá 50. Mặc định nếu không set giá trị gì sẽ là 30. |
| billId             | int              | ID hóa đơn trên Nhanh                                                                            |
| depotId            | int              | Tìm theo ID cửa hàng /api/store/depot                                                            |
| productName        | string(optional) | Tên/ Mã/ Mã vạch sản phẩm                                                                        |
| categoryId         | int(optional)    | ID danh mục sản phẩm                                                                             |
| internalCategoryId | int(optional)    | ID danh mục sản phẩm                                                                             |
| expiredFromDate    | date             | Tìm kiếm thời gian hết hạn bắt đầu từ ngày định dạng (yyyy-mm-dd). VD: 2022-09-25                |
| expiredToDate      | date             | Tìm kiếm thời gian hết hạn đến ngày (yyyy-mm-dd). VD: 2022-09-25                                 |
| fromDaysWarning    | int              | Số ngày cảnh báo từ ngày                                                                         |
| toDaysWarning      | int              | Số ngày cảnh báo đến ngày                                                                        |
| status             | int              | Tìm theo trạng thái sản phẩm. Giá trị có thể là: 1: Mới 2: Đã kiểm tra                           |

## Response

JSON decode the response to get the structure:

| Key      | Type  | Description                               |
| -------- | ----- | ----------------------------------------- |
| code     | int   | 1 = success or 0 = failed                 |
| messages | array | is an array of error messages if code = 0 |
| data     | array | is an array of product imei list          |

```javascript
data = [
    totalPages: int,
    products: [
        [ ], // each product item, all properties are listed in the table below
        ...
    ]
]
```

### Products

| Key              | Type       | Description               |
| ---------------- | ---------- | ------------------------- |
| id               | bigint(20) | ID sản phẩm trên Nhanh.vn |
| depotName        | string     | Kho                       |
| productName      | string     | Tên sản phẩm              |
| billId           | int        | Bill ID                   |
| quantity         | float      | Số lượng                  |
| expiredDate      | date       | Hạn sử dụng               |
| priorWarningDays | int        | Số ngày cảnh báo trước    |
| status           | int        | Trạng thái                |


---

# 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://apidocs.nhanh.vn/v2/product/expire.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.
