# Attribute

{% hint style="success" %}
API SERVER:

⇒ <mark style="color:yellow;">**<https://apivcloud.innoway.vn>**</mark>
{% endhint %}

## POST /api/attributes

> Create attributes

```json
{"openapi":"3.0.0","info":{"title":"Attribute","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"CreateAttributesListRequest":{"type":"object","properties":{"entity_type":{"type":"string","description":"Loại entity (ví dụ DEVICE, ASSET, USER)"},"entity_id":{"type":"string","format":"uuid","description":"Định danh duy nhất của entity"},"attributes":{"type":"array","description":"Danh sách thuộc tính gắn với entity","items":{"$ref":"#/components/schemas/Attribute_2"}}},"required":["entity_type","entity_id","attributes"]},"Attribute_2":{"type":"object","properties":{"attribute_type":{"type":"string","description":"Loại thuộc tính (ví dụ SCOPE_CLIENT, SCOPE_SERVER)"},"attribute_key":{"type":"string","description":"Khóa định danh thuộc tính"},"logged":{"type":"boolean","description":"Có lưu trữ giá trị thuộc tính vào log hay không(lưu lịch sử thay đổi giá trị)"},"value":{"type":"string","description":"Giá trị thuộc tính, có thể là chuỗi, số, boolean hoặc JSON được chuyển đổi thành dạng STRING"},"value_t":{"type":"string","description":"Kiểu dữ liệu của giá trị (STR, DBL, LONG, BOOL, JSON)"}}},"CreateAttributesListResponses":{"type":"object","properties":{"entity_type":{"type":"string","description":"Loại entity (ví dụ DEVICE, ASSET, USER)"},"entity_id":{"type":"string","format":"uuid","description":"Định danh duy nhất của entity"},"attributes":{"type":"array","description":"Danh sách thuộc tính gắn với entity","items":{"$ref":"#/components/schemas/Attribute_1"}}}},"Attribute_1":{"type":"object","properties":{"attribute_type":{"type":"string","description":"Loại thuộc tính (ví dụ SCOPE_CLIENT, SCOPE_SERVER)"},"attribute_key":{"type":"string","description":"Khóa định danh thuộc tính"},"logged":{"type":"boolean","description":"Có lưu trữ giá trị thuộc tính vào log hay không(lưu lịch sử thay đổi giá trị)"},"value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"object"}],"description":"Giá trị thuộc tính, có thể là chuỗi, số, boolean hoặc JSON"},"last_update_ts":{"type":"integer","format":"int64","description":"Thời gian cập nhật cuối cùng (timestamp, milliseconds)"},"value_type":{"type":"string","description":"Kiểu dữ liệu của giá trị (STR, DBL, LONG, BOOL, JSON)"}}}}},"paths":{"/api/attributes":{"post":{"summary":"Create attributes","tags":[],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAttributesListRequest"}}}},"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAttributesListResponses"}}}}}}}}}
```

## GET /api/attributes/DEVICE/{device\_id}/values

> Get all attributes

```json
{"openapi":"3.0.0","info":{"title":"Attribute","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"GetAllAttributesResponse":{"type":"object","properties":{"attributes":{"type":"array","description":"Danh sách thuộc tính kèm entity","items":{"$ref":"#/components/schemas/Attribute_3"}}}},"Attribute_3":{"type":"object","properties":{"entity_type":{"type":"string","description":"Loại entity (ví dụ DEVICE)"},"entity_id":{"type":"string","format":"uuid","description":"Định danh duy nhất của entity"},"attribute_type":{"type":"string","description":"Loại thuộc tính (SCOPE_CLIENT, SCOPE_SERVER)"},"attribute_key":{"type":"string","description":"Khóa định danh thuộc tính"},"logged":{"type":"boolean","description":"Có lưu trữ giá trị thuộc tính vào log hay không(lưu lịch sử thay đổi giá trị)"},"value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"object"}],"description":"Giá trị của thuộc tính"},"last_update_ts":{"type":"integer","format":"int64","description":"Thời gian cập nhật cuối (epoch millis)"},"value_type":{"type":"string","description":"Kiểu dữ liệu giá trị (STR, DBL, LONG, BOOL, JSON)"}}}}},"paths":{"/api/attributes/DEVICE/{device_id}/values":{"get":{"summary":"Get all attributes","tags":[],"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAllAttributesResponse"}}}}}}}}}
```

## GET /api/attributes/DEVICE/{device\_id}/{attribute\_type}/{attribute\_key}/values

> Get an attribute

```json
{"openapi":"3.0.0","info":{"title":"Attribute","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"Attribute_3":{"type":"object","properties":{"entity_type":{"type":"string","description":"Loại entity (ví dụ DEVICE)"},"entity_id":{"type":"string","format":"uuid","description":"Định danh duy nhất của entity"},"attribute_type":{"type":"string","description":"Loại thuộc tính (SCOPE_CLIENT, SCOPE_SERVER)"},"attribute_key":{"type":"string","description":"Khóa định danh thuộc tính"},"logged":{"type":"boolean","description":"Có lưu trữ giá trị thuộc tính vào log hay không(lưu lịch sử thay đổi giá trị)"},"value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"object"}],"description":"Giá trị của thuộc tính"},"last_update_ts":{"type":"integer","format":"int64","description":"Thời gian cập nhật cuối (epoch millis)"},"value_type":{"type":"string","description":"Kiểu dữ liệu giá trị (STR, DBL, LONG, BOOL, JSON)"}}}}},"paths":{"/api/attributes/DEVICE/{device_id}/{attribute_type}/{attribute_key}/values":{"get":{"summary":"Get an attribute","tags":[],"parameters":[],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Attribute_3"}}}}}}}}}
```

## GET /api/attributes/logged/DEVICE/{device\_id}/values

> Get all attribute log

```json
{"openapi":"3.0.0","info":{"title":"Attribute","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"LogsResponse":{"type":"object","properties":{"total":{"type":"integer","description":"Tổng số log tìm thấy"},"offset":{"type":"integer","description":"Vị trí bắt đầu của tập kết quả"},"limit":{"type":"integer","description":"Giới hạn số log"},"logs":{"type":"array","description":"Danh sách log","items":{"$ref":"#/components/schemas/LogEntry"}}}},"LogEntry":{"type":"object","properties":{"entity_type":{"type":"string","description":"Loại entity (ví dụ DEVICE)"},"entity_id":{"type":"string","format":"uuid","description":"Định danh duy nhất của entity"},"attribute_key":{"type":"string","description":"Khóa định danh thuộc tính được log"},"value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"object"}],"description":"Giá trị thuộc tính được log"},"ts":{"type":"integer","format":"int64","description":"Thời gian log (epoch millis)"},"value_type":{"type":"string","description":"Kiểu dữ liệu giá trị (STR, DBL, LONG, BOOL, JSON)"}}}}},"paths":{"/api/attributes/logged/DEVICE/{device_id}/values":{"get":{"summary":"Get all attribute log","tags":[],"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogsResponse"}}}}}}}}}
```

## GET /api/attributes/logged/DEVICE/{device\_id}/{attribute\_key}/values

> Get log of an attribute

```json
{"openapi":"3.0.0","info":{"title":"Attribute","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"LogsResponse":{"type":"object","properties":{"total":{"type":"integer","description":"Tổng số log tìm thấy"},"offset":{"type":"integer","description":"Vị trí bắt đầu của tập kết quả"},"limit":{"type":"integer","description":"Giới hạn số log"},"logs":{"type":"array","description":"Danh sách log","items":{"$ref":"#/components/schemas/LogEntry"}}}},"LogEntry":{"type":"object","properties":{"entity_type":{"type":"string","description":"Loại entity (ví dụ DEVICE)"},"entity_id":{"type":"string","format":"uuid","description":"Định danh duy nhất của entity"},"attribute_key":{"type":"string","description":"Khóa định danh thuộc tính được log"},"value":{"oneOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"object"}],"description":"Giá trị thuộc tính được log"},"ts":{"type":"integer","format":"int64","description":"Thời gian log (epoch millis)"},"value_type":{"type":"string","description":"Kiểu dữ liệu giá trị (STR, DBL, LONG, BOOL, JSON)"}}}}},"paths":{"/api/attributes/logged/DEVICE/{device_id}/{attribute_key}/values":{"get":{"summary":"Get log of an attribute","tags":[],"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"interval","in":"query","required":false,"schema":{"type":"integer"}},{"name":"startTime","in":"query","required":false,"schema":{"type":"integer"}},{"name":"endTime","in":"query","required":false,"schema":{"type":"integer"}},{"name":"orderBy","in":"query","required":false,"schema":{"type":"string"}},{"name":"aggType","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogsResponse"}}}}}}}}}
```

## PUT /api/attributes/DEVICE/{device\_id}/values

> Update attributes

```json
{"openapi":"3.0.0","info":{"title":"Attribute","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"UpdateAttributesRequest":{"type":"object","properties":{"attributes":{"type":"array","description":"Danh sách thuộc tính kèm entity","items":{"$ref":"#/components/schemas/Attribute_4"}}},"required":["attributes"]},"Attribute_4":{"type":"object","properties":{"attribute_key":{"type":"string","description":"Khóa định danh thuộc tính"},"value":{"type":"string","description":"Giá trị thuộc tính, có thể là chuỗi, số, boolean hoặc JSON được chuyển đổi thành dạng STRING"},"value_t":{"type":"string","description":"Kiểu dữ liệu giá trị (STR, DBL, LONG, BOOL, JSON)"}}}}},"paths":{"/api/attributes/DEVICE/{device_id}/values":{"put":{"summary":"Update attributes","tags":[],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAttributesRequest"}}}},"responses":{"200":{"description":"Cập nhật thuộc tính thành công","content":{"application/json":{}}}}}}}}
```

## PUT /api/attributes/DEVICE/{device\_id}/SCOPE\_CLIENT/{attribute\_key}/logged

> Update attribute logging

```json
{"openapi":"3.0.0","info":{"title":"Attribute","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}}},"paths":{"/api/attributes/DEVICE/{device_id}/SCOPE_CLIENT/{attribute_key}/logged":{"put":{"summary":"Update attribute logging","tags":[],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{}}}},"responses":{"200":{"description":"Xóa thành công","content":{"application/json":{}}}}}}}}
```

## DELETE /api/attributes/DEVICE/{device\_id}/SCOPE\_CLIENT/{attribute\_key}/values

> Delete attribute

```json
{"openapi":"3.0.0","info":{"title":"Attribute","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}}},"paths":{"/api/attributes/DEVICE/{device_id}/SCOPE_CLIENT/{attribute_key}/values":{"delete":{"summary":"Delete attribute","tags":[],"parameters":[],"responses":{"200":{"description":"Xóa thành công","content":{"application/json":{}}}}}}}}
```

## DELETE /api/attributes/DEVICE/{device\_id}/values

> Delete all attributes

```json
{"openapi":"3.0.0","info":{"title":"Attribute","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}}},"paths":{"/api/attributes/DEVICE/{device_id}/values":{"delete":{"summary":"Delete all attributes","tags":[],"parameters":[],"responses":{"200":{"description":"Xóa thành công","content":{"application/json":{}}}}}}}}
```


---

# 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://innoway.gitbook.io/innoway/tai-lieu/api/rest-api/attribute.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.
