# Organization

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

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

## POST /api/organizations

> Create organizations

```json
{"openapi":"3.0.0","info":{"title":"Organization","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"OrganizationCreate":{"type":"object","properties":{"name":{"type":"string","description":"Tên tổ chức"},"project_id":{"type":"string","format":"uuid","description":"ID của project mà tổ chức thuộc về"},"org_id":{"type":"string","format":"uuid","description":"ID tổ chức cha (nếu có)"},"description":{"type":"string","description":"Mô tả của tổ chức (nếu có)"},"attributes":{"type":"array","description":"Danh sách các thuộc tính (attributes) của tổ chức (nếu có)","items":{"$ref":"#/components/schemas/OrganizationAttribute"}}},"required":["name","project_id"]},"OrganizationAttribute":{"type":"object","properties":{"attribute_type":{"type":"string","description":"Phạm vi của attribute (SCOPE_CLIENT)"},"attribute_key":{"type":"string","description":"Tên khóa attribute"},"logged":{"type":"boolean","description":"Cho biết attribute có được ghi log lại hay không"},"value":{"type":"string","description":"Giá trị của attribute (dưới dạng string)"},"value_t":{"type":"string","description":"Kiểu dữ liệu của giá trị (STR = string, DBL = double, BOOL = boolean, JSON, LONG = integer)"}},"required":["attribute_type","attribute_key","value","value_t"]},"OrganizationCreateResponses":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"ID tổ chức"},"name":{"type":"string","description":"Tên tổ chức"},"project_id":{"type":"string","format":"uuid","description":"ID của project mà tổ chức thuộc về"},"org_id":{"type":"string","format":"uuid","description":"ID tổ chức cha (nếu có)"},"description":{"type":"string","description":"Mô tả của tổ chức (nếu có)"}}}}},"paths":{"/api/organizations":{"post":{"summary":"Create organizations","tags":[],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationCreate"}}}},"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationCreateResponses"}}}}}}}}}
```

## GET /api/organizations/{org\_id}

> Get organizations by id

```json
{"openapi":"3.0.0","info":{"title":"Organization","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"Organization":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"ID tổ chức"},"name":{"type":"string","description":"Tên tổ chức"},"project_id":{"type":"string","format":"uuid","description":"ID của project mà tổ chức thuộc về"},"org_id":{"type":"string","format":"uuid","description":"ID tổ chức cha (nếu có)"},"org_name":{"type":"string","description":"Tên tổ chức cha (nếu có)"},"description":{"type":"string","description":"Mô tả của tổ chức (nếu có)"},"attributes":{"type":"array","description":"Danh sách các thuộc tính (attributes) của tổ chức (nếu có)","items":{"$ref":"#/components/schemas/OrganizationAttributeResponse"}}}},"OrganizationAttributeResponse":{"type":"object","properties":{"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"},"value_as_string":{"type":"string","description":"là value của thuộc tính nhưng được biểu diễn dưới dạng chuỗi(string)"},"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/organizations/{org_id}":{"get":{"summary":"Get organizations by id","tags":[],"parameters":[],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Organization"}}}}}}}}}
```

## GET /api/organizations

> Get organizations list

```json
{"openapi":"3.0.0","info":{"title":"Organization","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"GetOrganizationsListResponse":{"type":"object","properties":{"total":{"type":"integer","description":"Tổng số tổ chức 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ố tổ chức"},"organizations":{"type":"array","description":"Danh sách các tổ chức có trong dự án","items":{"$ref":"#/components/schemas/Organization"}}}},"Organization":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"ID tổ chức"},"name":{"type":"string","description":"Tên tổ chức"},"project_id":{"type":"string","format":"uuid","description":"ID của project mà tổ chức thuộc về"},"org_id":{"type":"string","format":"uuid","description":"ID tổ chức cha (nếu có)"},"org_name":{"type":"string","description":"Tên tổ chức cha (nếu có)"},"description":{"type":"string","description":"Mô tả của tổ chức (nếu có)"},"attributes":{"type":"array","description":"Danh sách các thuộc tính (attributes) của tổ chức (nếu có)","items":{"$ref":"#/components/schemas/OrganizationAttributeResponse"}}}},"OrganizationAttributeResponse":{"type":"object","properties":{"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"},"value_as_string":{"type":"string","description":"là value của thuộc tính nhưng được biểu diễn dưới dạng chuỗi(string)"},"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/organizations":{"get":{"summary":"Get organizations list","tags":[],"parameters":[{"name":"project_id","in":"query","required":true,"schema":{"type":"string"}},{"name":"search_str","in":"query","required":false,"schema":{"type":"string"}},{"name":"org_id","in":"query","description":"Nếu có sẽ chỉ trả về danh sách các tổ chức con cấp dưới gần nhât của org_id","required":false,"schema":{"type":"string"}},{"name":"search_field","in":"query","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetOrganizationsListResponse"}}}}}}}}}
```

## GET /api/organizations/expand

> Get organizations list by level

```json
{"openapi":"3.0.0","info":{"title":"Organization","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"GetOrganizationsExpandResponse":{"type":"object","properties":{"total":{"type":"integer","description":"Tổng số tổ chức 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ố tổ chức"},"organizations":{"type":"array","description":"Danh sách các tổ chức có trong dự án được hiển thị dưới dạng cây phân cấp","items":{"$ref":"#/components/schemas/OrganizationExpand"}}}},"OrganizationExpand":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Định danh duy nhất của tổ chức"},"name":{"type":"string","description":"Tên tổ chức"},"org_id":{"type":"string","format":"uuid","description":"ID tổ chức cha (nếu có)"},"org_name":{"type":"string","description":"Tên tổ chức cha (nếu có)"},"project_id":{"type":"string","format":"uuid","description":"ID dự án mà tổ chức trực thuộc"},"sub_orgs":{"type":"array","description":"Danh sách tổ chức con","items":{"$ref":"#/components/schemas/Organization"}},"level":{"type":"string","description":"Cấp bậc tổ chức trong cây phân cấp"},"attributes":{"type":"array","description":"Danh sách các thuộc tính (attributes) của tổ chức (nếu có)","items":{"$ref":"#/components/schemas/OrganizationAttributeResponse"}}}},"Organization":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"ID tổ chức"},"name":{"type":"string","description":"Tên tổ chức"},"project_id":{"type":"string","format":"uuid","description":"ID của project mà tổ chức thuộc về"},"org_id":{"type":"string","format":"uuid","description":"ID tổ chức cha (nếu có)"},"org_name":{"type":"string","description":"Tên tổ chức cha (nếu có)"},"description":{"type":"string","description":"Mô tả của tổ chức (nếu có)"},"attributes":{"type":"array","description":"Danh sách các thuộc tính (attributes) của tổ chức (nếu có)","items":{"$ref":"#/components/schemas/OrganizationAttributeResponse"}}}},"OrganizationAttributeResponse":{"type":"object","properties":{"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"},"value_as_string":{"type":"string","description":"là value của thuộc tính nhưng được biểu diễn dưới dạng chuỗi(string)"},"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/organizations/expand":{"get":{"summary":"Get organizations list by level","tags":[],"parameters":[{"name":"project_id","in":"query","required":true,"schema":{"type":"string"}},{"name":"org_id","in":"query","required":false,"description":"Nếu có sẽ chỉ trả về các tổ chức con của org_id","schema":{"deprecated":false}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Thành công","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetOrganizationsExpandResponse"}}}}}}}}}
```

Các tổ chức trong ví dụ của api (Get organizations list by level) được tổ chức theo dạng sau :&#x20;

<figure><img src="/files/8S6XYz4gjRu8II1mblk4" alt=""><figcaption></figcaption></figure>

## PUT /api/organizations/{org\_id}

> Update organization

```json
{"openapi":"3.0.0","info":{"title":"Organization","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}},"schemas":{"OrganizationUpdate":{"type":"object","properties":{"name":{"type":"string","description":"Tên tổ chức"},"org_id":{"type":"string","format":"uuid","description":"ID tổ chức cha (nếu có)"},"description":{"type":"string","description":"Mô tả của tổ chức (nếu có)"}},"required":["name"]}}},"paths":{"/api/organizations/{org_id}":{"put":{"summary":"Update organization","tags":[],"parameters":[],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrganizationUpdate"}}}},"responses":{"200":{"description":"Thành công","content":{"application/json":{}}}}}}}}
```

## DELETE /api/organizations/{org\_id}

> Delete organization

```json
{"openapi":"3.0.0","info":{"title":"Organization","version":"1.0.0"},"servers":[{"url":"https://apivcloud.innoway.vn"}],"security":[{"BearerAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"<token>"}}},"paths":{"/api/organizations/{org_id}":{"delete":{"summary":"Delete organization","tags":[],"parameters":[],"responses":{"200":{"description":"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/organization.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.
