4.2.1.9 Create a department

POST /rest/orgwise/2/department

DESCRIPTION

Create a department.

MEDIA TYPE

application/json

REQUEST BODY

{ "name": "Dev 2", "parent": "2", "type": "DEPARTMENT", "no": "D3", "description": "", "leader": "username", "assignee": "username" } { "name": "Dev 2" }

BODY PARAM

Param

Type

Description

Required

Param

Type

Description

Required

name

string

The name of department.

Required

parent

string

The ID or No. of parent department. The default is null, which means creating a TOP class department.

Optional

type

string

The type of department. The default is “COMPANY“ if the department is TOP class, otherwise the default is “DEPARTMENT“. Optional types are COMPANY, SUB_COMPANY, BRANCH_COMPANY, BLOC, DEPARTMENT, SUB_DEPARTMENT.

Optional

no

string

The unique No. of department.

Optional

description

string

The description of department.

Optional

leader

string

Head of department, username of Jira user.

Optional

assignee

string

Head of department, username of Jira user.

Optional

RESPONSE

{ "code": 0, "msg": "Success", "data": { "id": 3, "no": "D4", "name": "Dev", "type": "SUB_DEPARTMENT", "parent": 2, "leader": { "id": 13, "workNumber": "E19", "gender": "MALE", "phone": "", "memo": "", "jiraUser": { "userKey": "JIRAUSER10116", "avatar": "https://www.gravatar.com/avatar/03c31b3cfde27dba0c5a6347a6bad01d?d=mm&s=16", "userName": "pluto154", "displayName": "pluto154", "emailAddress": "pluto154@dsd.com", "isActive": true }, "mainDepartment": { "id": 1, "no": "D1", "name": "DSD", "type": "COMPANY", "createTime": "2022-03-15 11:29:20" }, "departments": [ { "id": 1, "no": "D1", "name": "DSD", "type": "COMPANY", "createTime": "2022-03-15 11:29:20" }, { "id": 3, "no": "D4", "name": "Dev", "type": "SUB_DEPARTMENT", "createTime": "2022-03-15 13:00:39", "parent": 2 } ], "createTime": "2022-03-15 11:44:06.269" }, "assignee": { "id": 14, "workNumber": "E25", "gender": "MALE", "phone": "", "memo": "", "jiraUser": { "userKey": "JIRAUSER10122", "avatar": "https://www.gravatar.com/avatar/976c543445f4973ce327b3abd1602f9d?d=mm&s=16", "userName": "Amy211", "displayName": "Amy211", "emailAddress": "Amy211@dsd.com", "isActive": true }, "mainDepartment": { "id": 1, "no": "D1", "name": "DSD", "type": "COMPANY", "createTime": "2022-03-15 11:29:20" }, "departments": [ { "id": 1, "no": "D1", "name": "DSD", "type": "COMPANY", "createTime": "2022-03-15 11:29:20" }, { "id": 3, "no": "D4", "name": "Dev", "type": "SUB_DEPARTMENT", "createTime": "2022-03-15 13:00:39", "parent": 2 } ], "createTime": "2022-03-15 11:44:06.269" }, "parentDepartment": { "id": 2, "no": "D2", "name": "IT", "type": "DEPARTMENT", "createTime": "2022-03-15 13:00:39", "parent": 1 }, "rootDepartmentId": 1, "description": "Department", "createTime": "2022-03-15 13:00:39.496" } }