Gaurav
Gaurav

Reputation: 63

BambooHR APIs not giving complete Employee Details

I am developing an integration of BambooHR with an application. I need Employee Details from API. I found BambooHR API for this at https://documentation.bamboohr.com/reference#get-employees-directory-1

Endpoint: https://api.bamboohr.com/api/gateway.php/gauravtest2/v1/employees/directory . This API is giving me information like, First name, Last name, jobTitle, Mobile Phone, Work Email etc. But I also need Employee Hierarchy(Manager & Direct Reports), Status, Hiring Date etc. Thanks in advance

Upvotes: 3

Views: 3309

Answers (3)

TwoFingerRightClick
TwoFingerRightClick

Reputation: 832

Ensure that you have an API token that has permission to the Bamboo fields you need.

You can see all available fields at: https://api.bamboohr.com/api/gateway.php/{companyDomain}/v1/meta/fields/ and here is the doc page

Your token will need to be manually provisioned to see fields that are more sensitive. AFAIK this can be done when creating a token, granted you have sufficient privileges. I have only worked with the API, and had times were I have told a colleague to give me a token with more permissions and they have changed something using Bamboo admin pages to give me a new token with more permissions to fields.

Upvotes: 0

Benzara Tahar
Benzara Tahar

Reputation: 2207

you can use cusom reports to include the fields you want: Here is a curl command example:

curl --location --request POST 'https://api.bamboohr.com/api/gateway.php/<COMPANY_SUBDOMAIN>/v1/reports/custom?format=json' \
--header 'Accept: application/json' \
--header 'Encoding: utf-8' \
--header 'Content-Type: application/xml' \
--header 'Authorization: Basic [BASE64_CREDENTIALS]' \
--data-raw '
<report>
  <title>Employee details</title>
  <fields>
    <field id="id" />

    <field id="lastChanged" />

    <field id="status" />

    <field id="firstName" />
    <field id="middleName" />
    <field id="lastName" />
    <field id="nickname" />
    <field id="displayName" />
    <field id="gender" />
    <field id="DateOfBirth" />
    <field id="Age" />

    <field id="address1" />
    <field id="address2" />
    <field id="city" />
    <field id="state" />
    <field id="country" />
    <field id="zipCode" />

    <field id="homeEmail" />
    <field id="homePhone" />
    <field id="mobilePhone" />

    <field id="workEmail" />
    <field id="workPhone" />
    <field id="workPhoneExtension" />
    <field id="workPhonePlusExtension" />

    <field id="jobTitle" />
    <field id="department" />
    <field id="division" />
    <field id="location" />
    <field id="country" /> 

    <field id="employmentHistoryStatus" />
    <field id="terminationDate" />
    <field id="hireDate" />
    <field id="originalHireDate" />
    

    <field id="payRate" />
    <field id="payRateEffectiveDate" />
    <field id="payType" />
    <field id="paidPer" />
    <field id="paySchedule" />
    <field id="payScheduleId" />

    
    <field id="payFrequency" />
    <field id="payScheduleId" />
    

    <field id="supervisor" />
    <field id="supervisorEmail" />
    <field id="supervisorId" />
    <field id="supervisorEid" />
  </fields> 
</report>'

or some C# code:

var client = new RestClient("https://api.bamboohr.com/api/gateway.php/[COMPANY_SUBDOMAIN]/v1/reports/custom?format=json");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Accept", "application/json");
request.AddHeader("Encoding", "utf-8");
request.AddHeader("Content-Type", "application/xml");
request.AddHeader("Authorization", "Basic [BASE64_CREDENTIALS]");
var body = @"
" + "\n" +
@"<report>
" + "\n" +
@"  <title>Employee details</title>
" + "\n" +
@"  <fields>
" + "\n" +
@"    <field id=""id"" />
" + "\n" +
@"
" + "\n" +
@"    <field id=""lastChanged"" />
" + "\n" +
@"
" + "\n" +
@"    <field id=""status"" />
" + "\n" +
@"
" + "\n" +
@"    <field id=""firstName"" />
" + "\n" +
@"    <field id=""middleName"" />
" + "\n" +
@"    <field id=""lastName"" />
" + "\n" +
@"    <field id=""nickname"" />
" + "\n" +
@"    <field id=""displayName"" />
" + "\n" +
@"    <field id=""gender"" />
" + "\n" +
@"    <field id=""DateOfBirth"" />
" + "\n" +
@"    <field id=""Age"" />
" + "\n" +
@"
" + "\n" +
@"    <field id=""address1"" />
" + "\n" +
@"    <field id=""address2"" />
" + "\n" +
@"    <field id=""city"" />
" + "\n" +
@"    <field id=""state"" />
" + "\n" +
@"    <field id=""country"" />
" + "\n" +
@"    <field id=""zipCode"" />
" + "\n" +
@"
" + "\n" +
@"    <field id=""homeEmail"" />
" + "\n" +
@"    <field id=""homePhone"" />
" + "\n" +
@"    <field id=""mobilePhone"" />
" + "\n" +
@"
" + "\n" +
@"    <field id=""workEmail"" />
" + "\n" +
@"    <field id=""workPhone"" />
" + "\n" +
@"    <field id=""workPhoneExtension"" />
" + "\n" +
@"    <field id=""workPhonePlusExtension"" />
" + "\n" +
@"
" + "\n" +
@"    <field id=""jobTitle"" />
" + "\n" +
@"    <field id=""department"" />
" + "\n" +
@"    <field id=""division"" />
" + "\n" +
@"    <field id=""location"" />
" + "\n" +
@"    <field id=""country"" /> 
" + "\n" +
@"
" + "\n" +
@"    <field id=""employmentHistoryStatus"" />
" + "\n" +
@"    <field id=""terminationDate"" />
" + "\n" +
@"    <field id=""hireDate"" />
" + "\n" +
@"    <field id=""originalHireDate"" />
" + "\n" +
@"    
" + "\n" +
@"
" + "\n" +
@"    <field id=""payRate"" />
" + "\n" +
@"    <field id=""payRateEffectiveDate"" />
" + "\n" +
@"    <field id=""payType"" />
" + "\n" +
@"    <field id=""paidPer"" />
" + "\n" +
@"    <field id=""paySchedule"" />
" + "\n" +
@"    <field id=""payScheduleId"" />
" + "\n" +
@"
" + "\n" +
@"    
" + "\n" +
@"    <field id=""payFrequency"" />
" + "\n" +
@"    <field id=""payScheduleId"" />
" + "\n" +
@"    
" + "\n" +
@"
" + "\n" +
@"    <field id=""supervisor"" />
" + "\n" +
@"    <field id=""supervisorEmail"" />
" + "\n" +
@"    <field id=""supervisorId"" />
" + "\n" +
@"    <field id=""supervisorEid"" />
" + "\n" +
@"  </fields> 
" + "\n" +
@"</report>";
request.AddParameter("application/xml", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

NOTE: code generated by postman export

Upvotes: 2

user5921417
user5921417

Reputation: 23

BambooHr only gives some basic info on using the employees directory API to get detailed information of the employee you have use the get employee API. The end point looks like: https://api.bamboohr.com/api/gateway.php//v1/employees//?fields=employeeNumber,jobTitle,status,employmentHistoryStatus,address1,address2,birthday,bestEmail,workEmail,workPhone,city,country,department,ethnicity,firstName,lastName,gender,middleName,mobilePhone,zipcode,hireDate,supervisor,payRate,bonusAmount,commissionAmount,payFrequency

You would have to add the details you expect out of the API as query parameter.

Upvotes: 2

Related Questions