BambooHR API 未提供完整的员工详细信息

Posted

技术标签:

【中文标题】BambooHR API 未提供完整的员工详细信息【英文标题】:BambooHR APIs not giving complete Employee Details 【发布时间】:2020-11-16 16:36:19 【问题描述】:

我正在开发 BambooHR 与应用程序的集成。我需要来自 API 的员工详细信息。我在https://documentation.bamboohr.com/reference#get-employees-directory-1找到了 BambooHR API

端点:https://api.bamboohr.com/api/gateway.php/gauravtest2/v1/employees/directory。此 API 为我提供诸如名字、姓氏、职位名称、手机、工作电子邮件等信息。但我还需要员工层次结构(经理和直接报告)、状态、招聘日期等。提前致谢

【问题讨论】:

【参考方案1】:

BambooHr 仅提供一些基本信息,使用员工目录 API 来获取您使用 getemployee API 获得的员工的详细信息。终点长这样: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

您必须添加您期望从 API 中获取的详细信息作为查询参数。

【讨论】:

上面的链接已经失效了,但我认为之前的用户指的是:documentation.bamboohr.com/reference#get-employee【参考方案2】:

您可以使用自定义报告来包含您想要的字段: 这是一个 curl 命令示例:

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>'

或一些 C# 代码:

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);

注意:邮递员导出生成的代码

【讨论】:

以上是关于BambooHR API 未提供完整的员工详细信息的主要内容,如果未能解决你的问题,请参考以下文章

使用 Paypal rest API 未显示付款详细信息

Keycloak 未返回完整的用户详细信息

获取 Sql-Server 中逗号分隔值中未分组列的详细信息

Google Books API - 未返回图书详细信息

Firebase Crashlytics 未提供详细的崩溃信息

DRF:“详细信息”:“未提供身份验证凭据。”