> For the complete documentation index, see [llms.txt](https://apidocs.nhanh.vn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.nhanh.vn/v2/order/source.md).

# Nguồn đơn hàng

* /api/order/source: Tính năng này dùng để lấy danh sách nguồn đơn hàng.

## 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 là 1)                        |
| icpp | int    | Số row trên 1 trang (giá trị mặc định là 100, tối đa 100) |
| id   | int    | ID nguồn đơn hàng trên Nhanh.vn                           |
| name | string | Tên nguồn đơn hàng trên Nhanh.vn                          |

## 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 | Mảng danh sách nguồn đơn hàng             |

```php
data = [
    "totalPages" => int, // Tổng số trang
    "totalRecords" => int, // Tổng số bản ghi tất cả các trang
    "page" => int, // Trang hiện tại
    "sources" => [ // Danh sách nguồn đơn hàng trang hiện tại
        [
            // Nguồn đơn hàng 1
            "id" => int, // Id nguồn đơn hàng
            "name" => string, // Nguồn đơn hàng
            "createdAt" => int, // Ngày tạo(định dạng timestamp)
        ],
        [
            // Nguồn đơn hàng 2
        ],
        // ...
    }
]
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/order/source.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.
