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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Tbro
Regular Visitor

How to make dynamic API calls with POST requests in Power BI using M Parameters and a slicer

Hi everyone,

 

I'm working on a Power BI project where I need to access an API using M Parameters. My goal is to make dynamic API calls by selecting parameters from the dashboard through a slicer. So far, I've successfully set up the connection to the API and configured the parameter (in my example below it is called PARAMETER), but I haven't been able to make dynamic calls to the API yet. I know it's possible to make dynamic calls for GET requests using the RelativePath functionality of Web.Contents, but I'm stuck on how to achieve something similar for POST requests.

Currently, I can only update the query from the dashboard via the following route: Home > Transform data > Edit parameters. However, I would like to do it directly from the dashboard using a slicer. Is there any way I can do this?

 
Thank you very much in advance for the support.

Here's my current query:

 

 

let
    headers = [
        #"Content-Type" = "application/json",
        ],
    Body = " { ""criteria"": """& PARAMETER &"""}"
    RelativePath = "somePath",
    options = [
        RelativePath = RelativePath,
        Headers = headers,
        Content = Text.ToBinary(Body),
        ManualStatusHandling = {400,404,500}
    ],
    Source = Web.Contents("main_url", options),
    Response = Json.Document(Source),
in
    Response

 

 

0 REPLIES 0

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors