Employee - GET

This article explains how to fetch employee details using APIs.

Get All Employees

Retrieves a list of employees. When no parameters are added, all the employees are returned. 

GET /xEmployee

For example, 

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

Response:

Status: 200 OK

[
{
"Id": "8320fb07077a2935",
"xAddress1": "19 Cherry Lane",
"xAddress2": null,
"xBonus": {
"Amount": 2200,
"Currency": "USD"
},
"xCellPhone": "310-654-8712",
"xCity": "Santa Monica",
"xCountry": null,
"xDateOfBirth": "1969-09-21T00:00:00Z",
"xDepartmentLookup": {
"__ObjectName": "xDepartment",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xDepartment/8320fb07077a2935",
"Id": "8320fb07077a2935",
"xDepartmentCode": "FIN",
"xDepartmentName": "FINANCE",
"xRecordStatus": "Active"
},
"xDivisionLookup": {
"__ObjectName": "xDivision",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xDivision/5d03e0d8dd13c7ea",
"Id": "5d03e0d8dd13c7ea",
"xDivisionCode": "Expenses",
"xDivisionName": "EXP",
"xRecordStatus": "Active"
},
"xEducationLevel": null,
"xEmail": "asmith@mytown.org",
"xEmployeeNumber": "8734",
"xEmploymentStatusLookup": {
"__ObjectName": "xEmploymentStatus",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xEmploymentStatus/8320fb07077a2935",
"Id": "8320fb07077a2935",
"xRecordStatus": "Active",
"xType": "Active"
},
"xEmploymentTypeLookup": null,
"xEthnicity": null,
"xFirstName": "Amanda",
"xFullName": "Amanda Smith",
"xGender": null,
"xLastName": "Smith",
"xLocationLookup": {
"__ObjectName": "xLocation",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xLocation/5d03e0d8dd13c7ea",
"Id": "5d03e0d8dd13c7ea",
"xDescription": null,
"xLocationCode": "LA",
"xLocationName": "Los Angeles",
"xRecordStatus": "Active"
},
"xManagerLookup": {
"__ObjectName": "xEmployee",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xEmployee/011151b847015c07",
"Id": "011151b847015c07",
"xFullName": "John Faynard"
},
"xMIddleName": "mIddle1",
"xNickname": null,
"xPersonalEmail": null,
"xPositionLookup": {
"__ObjectName": "xPosition",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xPosition/8320fb07077a2935",
"Id": "8320fb07077a2935",
"xDescription": "<p>asdasdasd</p>",
"xPositionCode": "Hr0023211",
"xPositionTitle": "HR Managerrrrrrr",
"xRecordStatus": "Active"
},
"xRecordStatus": "Active",
"xSalary": {
"Amount": 75000,
"Currency": "USD"
},
"xSeparationDate": "null,
"xSeparationReason": null,
"xStartDate": "2014-07-15T00:00:00Z",
"xState": "none1",
"xVeteranStatus": null,
"xWorkPhone": null,
"xZipCode": "90403"
}
...
]

Get a particular employee

Retrieve a particular employee record.

GET /xEmployee/:employeeId

For example,

GET https://corehr-api.hrcloud.com/v1/cloud/xEmployee/8320fb07077a2935

Response

Status: 200 OK

[
{
"Id": "8320fb07077a2935",
"xAddress1": "19 Cherry Lane",
"xAddress2": null,
"xBonus": {
"Amount": 2200,
"Currency": "USD"
},
"xCellPhone": "310-654-8712",
"xCity": "Santa Monica",
"xCountry": null,
"xDateOfBirth": "1969-09-21T00:00:00Z",
"xDepartmentLookup": {
"__ObjectName": "xDepartment",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xDepartment/8320fb07077a2935",
"Id": "8320fb07077a2935",
"xDepartmentCode": "FIN",
"xDepartmentName": "FINANCE",
"xRecordStatus": "Active"
},

...
]
Please note that you can add filters as query parameters to limit the records in the response or the fields in a record. Refer the article Query format to learn to add filters to a query.

 

Example 1: Get firstname, lastname and employee number of all the employees in the organization. 

Request:

GET https://corehr-api.hrcloud.com/v1/cloud/xEmployee?select=xFirstName,xLastName,xEmployeeNumber

Response:

[
 {
 "xEmployeeNumber": "12344",
 "xFirstName": "Jackson",
 "xLastName": "K"
 },
 {
 "xEmployeeNumber": "123454",
 "xFirstName": "AMY",
 "xLastName": "S"
 },
 {
 "xEmployeeNumber": "dbalachandran",
 "xFirstName": "Dhanya",
 "xLastName": "Balachandran"
 } ,
 {
 "xEmployeeNumber": "CBeavers",
 "xFirstName": "Connie",
 "xLastName": "Beavers"
 },

...
]

Example 2: Get a list of the full name of all the employees who are from Denver.

Request:

https://corehr-api.hrcloud.com/v1/cloud/xEmployee?filter=xLocation eq 'Denver' &select=xFullName

Response:

[
 {
 "xFullName": "Jackson K"
 },
 {
 "xFullName": "AMY S"
 },
 {
 "xFullName": "Dhanya Balachandran"
 },
 {
 "xFullName": "Connie Beavers"
 },
 {
 "xFullName": "Roy Burger"
 },
 { 
 "xFullName": "Tate Crosby"
 },

...

]

Example 3: Get a list of all the employees in the order of their joining date.

Request:

https://corehr-api.hrcloud.com/v1/cloud/xEmployee?sort=xStartDate asc

Response:

[
{
"Id": "defc24ead9b34bacb28e5ed1c2d80520",
"xAddress1": null,
"xAddress2": null,
"xBonus": {
"Amount": null,
"Currency": null
},
"xCellPhone": null,
"xCity": null,
"xCountry": null,
"xCreatedOn": "2018-07-12T17:28:28.293Z",
"xDateOfBirth": null,
"xDepartmentLookup": {
"__ObjectName": "xDepartment",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xDepartment/3bb5325d5ad8fc1b0af6bbfa8de57ca2",
"Id": "3bb5325d5ad8fc1b0af6bbfa8de57ca2",
"xDepartmentCode": "c844d7ee-1869-4b15-8492-5d37c97be6c6",
"xDepartmentName": "Executive",
"xRecordStatus": "Active"
},
"xDivisionLookup": {
"__ObjectName": "xDivision",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xDivision/ed7f714f9599c7f5ce850a5886a0b178",
"Id": "ed7f714f9599c7f5ce850a5886a0b178",
"xDivisionCode": "ec963521-01d7-4334-9105-ca6fb2cfedb6",
"xDivisionName": "United States",
"xRecordStatus": "Active"
},
"xEducationLevel": null,
"xEmail": "Steven@dummy.com",
"xEmployeeNumber": "SGrimes",
"xEmploymentStatusLookup": {
"__ObjectName": "xEmploymentStatus",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xEmploymentStatus/54ce3fe48ac9ebbf72b6a178ae039ec0",
"Id": "54ce3fe48ac9ebbf72b6a178ae039ec0",
"xRecordStatus": "Active",
"xType": "Active"
},
"xEmploymentTypeLookup": null,
"xEthnicity": null,
"xFirstName": "Steven",
"xFullName": "Steven Grimes",
"xGender": null,
"xLastName": "Grimes",
"xLocationLookup": {
"__ObjectName": "xLocation",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xLocation/6035d64a4202ca7a6178ae8fa6dc0a44",
"Id": "6035d64a4202ca7a6178ae8fa6dc0a44",
"xAddress": null,
"xDescription": null,
"xLocationCode": "4821bf69-7af9-4915-87e9-486cb1b01cbd",
"xLocationName": "Denver",
"xRecordStatus": "Active"
},
"xManagerLookup": null,
"xMiddleName": null,
"xNickname": null,
"xNumberOfPoints": null,
"xOnboardingFinishedOn": null,
"xPayFrequencyType": null,
"xPayRateLookup": null,
"xPersonalEmail": null,
"xPictures": {
"OriginalPictureResourceCropParameters": null,
"SmallResourceId": null,
"OriginalResourceId": null,
"MediumResourceId": null
},
"xPositionLookup": {
"__ObjectName": "xPosition",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xPosition/8f72612cca4b41d4abd1154682eb36dd",
"Id": "8f72612cca4b41d4abd1154682eb36dd",
"xDescription": null,
"xPositionCode": "5c5e1ded-c1ca-4b96-8684-e62786f6d8f8",
"xPositionTitle": "Vice President of Learning Solutions-FNL",
"xRecordStatus": "Active"
},
"xRecordStatus": "Active",
"xSalary": {
"Amount": null,
"Currency": null
},
"xSeparationDate": null,
"xSeparationReason": null,
"xStartDate": "2002-06-16T00:00:00Z",
"xState": null,
"xUpdatedOn": "2018-07-12T17:28:28.293Z",
"xVeteranStatus": null,
"xWorkExperienceInCompany": null,
"xWorkExperiencePrior": {
"Year": null,
"Month": null,
"Day": null
},
"xWorkExperienceTotal": null,
"xWorkPhone": null,
"xZipCode": null
},
{
"Id": "defc24ead9b34bac044f7ec574238ad4",
"xAddress1": null,
"xAddress2": null,
"xBonus": {
"Amount": null,
"Currency": null
},
"xCellPhone": null,
"xCity": null,
"xCountry": null,
"xCreatedOn": "2018-07-12T17:28:13.803Z",
"xDateOfBirth": null,
"xDepartmentLookup": {
"__ObjectName": "xDepartment",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xDepartment/b4a0e4a68d38f2d947d2f9932ec3b4f7",
"Id": "b4a0e4a68d38f2d947d2f9932ec3b4f7",
"xDepartmentCode": "88771f14-7b7f-4587-90de-522952926c35",
"xDepartmentName": "dep HR",
"xRecordStatus": "Active"
},
"xDivisionLookup": {
"__ObjectName": "xDivision",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xDivision/ed7f714f9599c7f5ce850a5886a0b178",
"Id": "ed7f714f9599c7f5ce850a5886a0b178",
"xDivisionCode": "ec963521-01d7-4334-9105-ca6fb2cfedb6",
"xDivisionName": "United States",
"xRecordStatus": "Active"
},
"xEducationLevel": null,
"xEmail": "Roy@dummy.com",
"xEmployeeNumber": "RBurger",
"xEmploymentStatusLookup": {
"__ObjectName": "xEmploymentStatus",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xEmploymentStatus/54ce3fe48ac9ebbf1869d52d43f715ef",
"Id": "54ce3fe48ac9ebbf1869d52d43f715ef",
"xRecordStatus": "Active",
"xType": "Terminated"
},
"xEmploymentTypeLookup": null,
"xEthnicity": null,
"xFirstName": "Roy",
"xFullName": "Roy Burger",
"xGender": null,
"xLastName": "Burger",
"xLocationLookup": {
"__ObjectName": "xLocation",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xLocation/6035d64a4202ca7a6178ae8fa6dc0a44",
"Id": "6035d64a4202ca7a6178ae8fa6dc0a44",
"xAddress": null,
"xDescription": null,
"xLocationCode": "4821bf69-7af9-4915-87e9-486cb1b01cbd",
"xLocationName": "Denver",
"xRecordStatus": "Active"
},
"xManagerLookup": null,
"xMiddleName": null,
"xNickname": null,
"xNumberOfPoints": null,
"xOnboardingFinishedOn": null,
"xPayFrequencyType": null,
"xPayRateLookup": null,
"xPersonalEmail": null,
"xPictures": {
"OriginalPictureResourceCropParameters": null,
"SmallResourceId": null,
"OriginalResourceId": null,
"MediumResourceId": null
},
"xPositionLookup": {
"__ObjectName": "xPosition",
"__Self": "https://corehr-api.hrcloud.com/v1/cloud/xPosition/8f72612cca4b41d4b59217de43195f3a",
"Id": "8f72612cca4b41d4b59217de43195f3a",
"xDescription": null,
"xPositionCode": "ab19bce8-2cb3-427f-aa68-9aec79b0cf76",
"xPositionTitle": "President",
"xRecordStatus": "Active"
},
"xRecordStatus": "Active",
"xSalary": {
"Amount": null,
"Currency": null
},
"xSeparationDate": "2019-08-21T00:00:00Z",
"xSeparationReason": null,
"xStartDate": "2005-01-01T00:00:00Z",
"xState": null,
"xUpdatedOn": "2019-08-21T17:19:25.397Z",
"xVeteranStatus": null,
"xWorkExperienceInCompany": null,
"xWorkExperiencePrior": {
"Year": null,
"Month": null,
"Day": null
},
"xWorkExperienceTotal": null,
"xWorkPhone": null,
"xZipCode": null
},
...
]

Get all the attachments linked to an employee

GET /xEmployee/:employeeId/attachments

Retrieves the list of attachments of an employee.  Please note that it requires special permissions for a user to be able to view or download the attachments of any employee. For example, 

Request:

GET https://corehr-api.hrcloud.com/v1/cloud/xEmployee/42207b4aefd32d9c9219453bdf988623/attachments

Response:

[
{
"Id": "f2ea0a3cce4ce7e16de991c3ebf42c75",
"xCreatedBy": {
"__ObjectName": "xUser",
"__Self": "http://corehr-api.local.neogov.net/v1/cloud/xUser/319d7719cba696f4fa74f1fe1254a559",
"Id": "319d7719cba696f4fa74f1fe1254a559",
"xEmployeeId": null,
"xFullName": "System Admin",
"xSmallPictureId": null
},
"xCreatedOn": "2018-10-24T09:14:22.093Z",
"xRelatedEntityDetailsLookup": {
"__ObjectName": "xRelatedEntityDetails",
"__Self": "http://corehr-api.local.neogov.net/v1/cloud/xRelatedEntityDetails/42207b4aefd32d9c9219453bdf988623",
"Id": "42207b4aefd32d9c9219453bdf988623",
"xName": "Employee 1 Employee 1"
},
"xResourceLookup": {
"__ObjectName": "xResource",
"__Self": "http://corehr-api.local.neogov.net/v1/cloud/xResource/b8a2a1395b52942570329d9df6fa8f9e",
"Id": "b8a2a1395b52942570329d9df6fa8f9e",
"xName": "account.txt",
"xSizeInBytes": 633
},
"xTitle": "account.txt"
},
....
]

Get a particular attachment linked to an employee

GET /xEmployee/:employeeId/attachments/:attachmentId

Retrieves a requested attachment linked to an employee. Viewing or downloading attachments for any employee requires special user permissions.

Request:

GET https://corehr-api.hrcloud.com/v1/cloud/xEmployee/42207b4aefd32d9c9219453bdf988623/attachments/692affafc7c3b321dd43e63f2c9e5d84

Download all the attachments linked to an employee

GET /xEmployee/:employeeId/attachments/download

Downloads all the attachments of an employee. The response content is a file stream in zip format containing all files belonging to that employee. For example,

Request:

GET https://corehr-api.hrcloud.com/v1/cloud/xEmployee/42207b4aefd32d9c9219453bdf988623/attachments/download

Download a particular attachment linked to an employee

GET /xEmployee/:employeeId/attachments/download/:attachmentId

Downloads a particular attachment linked to an employee. The attachment ID of the attachment should be provided in the URL. The response content is a file stream content from the attachment belonging to that employee. For example,

Request:

GET https://corehr-api.hrcloud.com/v1/cloud/xEmployee/42207b4aefd32d9c9219453bdf988623/attachments/download/692affafc7c3b321dd43e63f2c9e5d84

Download a few attachments linked to an employee

GET /xEmployee/:employeeId/attachments/download/:attachmentId1,:attachmentId2,...

Download some attachments linked to an employee.  All the attachment Ids are provided in the URL ,separated by comma(,). The response content is a file stream in zip format containing requested files belonging to that employee. For example,

Request:

GET https://corehr-api.hrcloud.com/v1/cloud/xEmployee/42207b4aefd32d9c9219453bdf988623/attachments/download/692affafc7c3b321dd43e63f2c9e5d84,892affa5k7c3b321dd43e63f2c9e5d84