Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
darko861
Resolver II
Resolver II

Connecting to API error message

Hi all

 

I'm writing to seek assistance with connecting to the HiBOB HR system via its REST API. I'm currently attempting to modify the existing code to utilize the 'Authorization as Headers' method, but I'm encountering error messages.

 

Initially, I was using the following code with Basic authentication which works great:

darko861_0-1700479205152.png

The credentials are written here:

darko861_1-1700479341432.png

 

But I want to change the code in the advanced editor to this:

 

darko861_2-1700479683481.png

 

I get an error message as shown above. I then tried to change the connection to Anonymous:

 

darko861_3-1700479862779.png

I then get this message:

 

darko861_4-1700479944590.png

 

My ultimate goal is to create a function that iterates through a column of different IDs, as depicted below:

To achieve this, I need to incorporate the Authorization as Headers method within the code. However, the current implementation is causing errors. Is there a way to tweak the code inside the advanced editor? Maybe it's this part of the code that doesn't work: Headers = [Authorization="Basic XXX-0000:API_wise:x000xxx000000x"].

 

Could you please advise on any potential modifications to the code within the advanced editor to resolve these authentication errors and enable the desired functionality?

Thank you for your time and consideration.

 

I have found that this code will give the correct connection:

 

let
apiKey = "x000xxx000000x", username = "XXX-0000",
password = "x000xxx000000x", auth = "Basic " & Binary.ToText(Text.ToBinary(username & ":" & password), BinaryEncoding.Base64),
apiUrl = "https://api.hibob.com", query = "/v1/people",
url = apiUrl & query, headers = [ #"Authorization" = auth, #"APIKey" = apiKey ], source = Json.Document(Web.Contents(url, [Headers=headers]))
in
source

 

But how can I incorporate that code when creating my function using the relative path as shown below?:

 

 

(id as text)=>

let
Source = Json.Document(Web.Contents("https://api.hibob.com",
[
RelativePath = "/v1/people/" & id & "/employment",
Headers = [Authorization="Basic XXX-0000:API_wise:x000xxx000000x"]
])),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
in
#"Converted to Table"

1 ACCEPTED SOLUTION
darko861
Resolver II
Resolver II

Hi,

After thorough testing, I determined that this method is the most effective, as it consistently produces the desired outcome.

 

 

(id as text)=>

let
apiKey = "x000xxx000000x", username = "Basic XXX-0000",
password = "x000xxx000000x",
auth = "Basic " & Binary.ToText(Text.ToBinary(username & ":" & password), BinaryEncoding.Base64),
apiUrl = "https://api.hibob.com",
query = "/v1/people/id/employment",
url = apiUrl,
headers = [ #"Authorization" = auth, #"APIKey" = apiKey ],
Source = Json.Document(Web.Contents(url,
[
RelativePath = "/v1/people/" & id & "/employment",
Headers=[#"Authorization" = auth, #"APIKey" = apiKey ]

]))
in
Source

View solution in original post

1 REPLY 1
darko861
Resolver II
Resolver II

Hi,

After thorough testing, I determined that this method is the most effective, as it consistently produces the desired outcome.

 

 

(id as text)=>

let
apiKey = "x000xxx000000x", username = "Basic XXX-0000",
password = "x000xxx000000x",
auth = "Basic " & Binary.ToText(Text.ToBinary(username & ":" & password), BinaryEncoding.Base64),
apiUrl = "https://api.hibob.com",
query = "/v1/people/id/employment",
url = apiUrl,
headers = [ #"Authorization" = auth, #"APIKey" = apiKey ],
Source = Json.Document(Web.Contents(url,
[
RelativePath = "/v1/people/" & id & "/employment",
Headers=[#"Authorization" = auth, #"APIKey" = apiKey ]

]))
in
Source

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

Check out the July 2026 Power BI update to learn about new features.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.