Forum Discussion
Pull Data from timebutler
Hey,
I want to get some data from our employees absences from the tool we use called timebutler. Unfortunately they only accept http POST requests and Power BI seems to use GET. I have a link (https://timebutler.de/api/v1/absences) and an API Token. According to the documentary a CSV UTF-8 coded will be provided. I also have to set a parameter for the year (YYYY). So my question now is... How.. 😄 I am a newbie regarding these M queries so I am looking forward to your help for generating a customized query in M.
Greets
1 Reply
- AnonymousNot applicable
Hi SarahAlsterspre ,
- In Power BI Desktop, go to Home > Advanced Editor.
- Replace the existing code with the following M query:
let apiToken = "your_api_token_here", year = "2022", url = "https://timebutler.de/api/v1/absences", headers = [ #"Content-Type" = "application/json", #"Authorization" = "Bearer " & apiToken ], options = [ Headers = headers, Content = Text.ToBinary("year=" & year), ManualStatusHandling = {400, 404} ], response = Web.Contents(url, options), statusCode = Value.Metadata(response)[Response.Status], result = if statusCode = 200 then Csv.Document(response, [Delimiter=",", Encoding=65001, QuoteStyle=QuoteStyle.None]) else error "Request failed with status code: " & Text.From(statusCode) in result- Replace with your actual API token.
Please refer to the following document for more information.
Power Query Web connector - Power Query | Microsoft Learn
Pull data from API using POST method in Power BI - Microsoft Fabric Community
Best Regards,
Neeko Tang
If this post  helps, then please consider Accept it as the solution  to help the other members find it more quickly.