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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Paulinabartus
New Member

Tokenized rest api with using RelativePath

Hi All,

hope somebody can help me. I cannot figure out how to use RelativePath in the below query. Could somebody have a look please? 

 

The initial problem here is that I am trying to connect powerBI with another tool using tokenized REST API. In powerBI service the data cannot be refreshed due to the dynamic data. 

Thank you in advance for help

 

 

let
    //Authentication
 
    //URI's - Best Practice to Filter Arch & Type in Resource URL
    token_uri = "https://axaxl.avolutionsoftware.com/api/Token", //<===parameter
    resource = "https://axaxl.avolutionsoftware.com/api/Components?$filter=ComponentTypeName eq 'Application' and ArchitectureName eq 'AXA XL Actual' &$expand=Properties($filter=Type eq 'Information'),InConnections($filter=ConnectionTypeName eq 'Requires' ; $expand=SourceComponent ;$filter=SourceComponent/ComponentTypeName eq 'Application')",
 
//<===parameter
 
    //User Details(Modify)
    username = "xxx", //<===parameter
    password = "xxx", //<===parameter
    grant_type = "password",
 
    // Build query string(Do Not Modify)
    query = Uri.BuildQueryString([
        username = username,
        password = password,
        resource = resource,
        grant_type = grant_type
    ]),
 
    // Build HTTP request
    options = [
        Headers = [Accept="application/json"],
        ManualStatusHandling={400}
    ],
    content = Text.ToBinary(query),
    request = Web.Contents(token_uri, options & [Content = content]),
 
    // Parse JSON response and extract access token
    response = Json.Document(request,65001),
    access_token = response[access_token],
    token = "Bearer " & access_token,
 
    Source = OData.Feed(resource, null, [Headers=[Authorization = token ]]),
    
   
in
    Source
1 REPLY 1
rubayatyasmin
Community Champion
Community Champion

Hi, @Paulinabartus 

 

your base URL is https://axaxl.avolutionsoftware.com/api/ and you want to access the endpoint Components, you would set RelativePath to "Components". But from your existing code, it seems like you are already specifying the complete URL in the resource variable, so you do not need this param. 

I found similar thread that might be helpful, 

https://community.fabric.microsoft.com/t5/Power-Query/How-to-use-Relative-Path/td-p/2673874

 

https://community.fabric.microsoft.com/t5/Power-Query/API-with-relative-path/td-p/1832792

 

https://community.fabric.microsoft.com/t5/Desktop/Parameter-in-base-url-Relative-path-DynamicDataSou...

 

rubayatyasmin_0-1689517080227.png

 


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors