Division

This article explains the APIs related to creating, editing or fetching division details.

Divisions are logical groupings of the people of an organization intended to make functions more organized and orderly. 

A division object consists of the following fields.

Field

Description

xDivisionCode

Unique alpha-numeric code for division

xDivisionName

Name of the division

xRecordStatus

Status of the division - active or inactive
Id Unique identifier of the division. This is an auto-generated field. 

Get All Divisions

GET /xDivision

Retrieves all the divisions of the organization. For example,

GET https://corehr-api.hrcloud.com/v1/cloud/xDivision

Response:

{
"Id": "8320fb07077a2935",
"xDivisionCode": "PR1",
"xDivisionName": "Payroll",
"xRecordStatus": "Active"
},
{
"Id": "1249a68e0462d50d",
"xDivisionCode": "PM0010",
"xDivisionName": "Expense Mangement",
"xRecordStatus": "Active"
},
{
"Id": "49fd50d7a91114b3",
"xDivisionCode": "SRV",
"xDivisionName": "Employment Services",
"xRecordStatus": "Active"
},
...
]

Get a particular division

GET /xDivision/:divisionId

Retrieve a single division using the specified Id. For example,

GET https://corehr-api.hrcloud.com/v1/cloud/xDivision/49fd50d7a91114b3

Response:

{
"Id": "49fd50d7a91114b3",
"xDivisionName": "Employment Services",
"xDivisionCode": "SRV",
"xRecordStatus": "Active"
}

Create a new Division

POST /xDivision

Creates a new division with the provided input parameters.

The following input parameters are required to be sent with the POST request.

Name Type Description Mandatory
xDivisionCode String Unique alpha-numeric code for division Yes
xDivisionName String Name of division Yes
xRecordStatus String Active or Inactive Yes

When a new division is successfully created, an auto generated Id field is assigned to the object.

For example,

Request:

POST https://corehr-api.hrcloud.com/v1/cloud/xDivision
{
"xDivisionName": "Client Project Management",
"xDivisionCode": "CPM1",
"xRecordStatus": "Active"
}

Response: Status 200

[
{
"Id": "dcdb382bfdf84d255121458b4dfb66da",
"xDivisionCode": "CPM1",
"xDivisionName": "Client Project Management",
"xRecordStatus": "Active"
}
]

Edit an existing division

PUT /xDivision

Updates a division using the specified ID (or field in the method) and input parameters.

There are two ways to identify the division to be updated.

1. Provide the unique Id of the division. In this case, provide the division Id in the payload for the division. The Id cannot be edited. If Id is present in the payload, it is used to identify the division. For example,

PUT https://corehr-api.hrcloud.com/v1/cloud/xDivision

Input fields:

[
{
"Id": "ed7f714f9599c7f535ffa4a52334b959",
"xDivisionCode": "PAY",
"xDivisionName": "Payroll",
"xRecordStatus": "Active"
}
]

In this case, the record for the division with Id = "ed7f714f9599c7f535ffa4a52334b959" will be updated.

Response:

[
{
"Id": "ed7f714f9599c7f535ffa4a52334b959",
"xDivisionCode": "PAY",
"xDivisionName": "Payroll",
"xRecordStatus": "Active"
}
]

2. Use any other field to identify the division record to be updated. In this case, specify the identifier field in the URL. Please note that only a unique field can be used identify the record to be updated

For example, 

Request:

PUT https://corehr-api.hrcloud.com/v1/cloud/xDivision?Identifier=xDivisionCode

Input Parameters:

[
{
"xDivisionCode": "PAY",
"xDivisionName": "Payroll - New York"
}
]