Organization
Create New Organization
Description
Create a new organization, supporting up to 4 levels, with only one root organization.
Request Config
| Config | Definition |
|---|---|
| URL | /org |
| Method | POST |
| Content-Type | application/json |
Params
| Name | Type | Description | Required |
|---|---|---|---|
| parent_id | int64 | Parent id | No |
| name | string | Organization name,maximum 50 bit | Yes |
| code | string | Organization code码,maximum 100 bit | Yes |
Request Body Schema
json
{
"parent_id": 123,
"name": "Headquarter",
"code": "DUZB"
}Response
Schema of data
| Name | Type | Description |
|---|---|---|
| id | int64 | Organization id |
| parent_id | int64 | Parent id |
| name | string | Organization name |
Response Body Sample
json
{
"code": 0,
"message": "",
"data": {
"id": 233,
"parent_id": 123,
"name": "Headquarter",
"code": "DUZB"
}
}Update Organization
Description
Update organization, currently only supports changing the organization name.
Request Config
| Config | Definition |
|---|---|
| URL | /org |
| Method | PUT |
| Content-Type | application/json |
Request Body Schema
json
{
"id": 123,
"name": "Headquarter"
}Response
Response Body Sample
json
{
"code": 0,
"message": ""
}Delete Organization
Description
Delete organization. Prerequisite: No users under the organization.
Request Config
| Config | Definition |
|---|---|
| URL | /org/<id> |
| Method | DELETE |
Path
| Name | Type | Description | Required |
|---|---|---|---|
| id | int64 | Organization id | Yes |
Response
Response Body Sample
json
{
"code": 0,
"message": ""
}Query Organization List
Description
Query organization list, returns an organization tree, which currently has only one.
Request Config
| Config | Definition |
|---|---|
| URL | /org/list |
| Method | GET |
Response
Schema of data
| Name | Type | Description |
|---|---|---|
| id | int64 | Organization id |
| parent_id | int64 | Parent organization id |
| name | string | Organization name |
| code | string | Organization code |
| children | []object | Child organization,consistent with the parent's, it's empty when there are no child organization |
Response Body Sample
json
{
"code": 0,
"message": "",
"data": {
"orgs": [
{
"id": 233,
"parent_id": 3232,
"name": "Headquarter",
"code": "ZB",
"children": [
{
"id": 234,
"parent_id": 233,
"name": "Clique",
"code": "JT",
"children": null
}
]
}
]
}
}