X-Total-Count not being returned in Power Query

Hi! I’m using Power Query in Power BI to pull data from SailPoint. I’m trying to use either the “count=true” header in an api call or the “https://tenant.api.sailpoint/v3/search/count” call to receive the “X-Total-Count” header in the response, but Power Query does not seem to return this header in the response. When I do the same call in Postman, I’m able to receive the header, but not in Power BI. Any insights would be helpful!

Try this :

let
    
    url = "https://tenant.api.sailpoint/v3/search/count",

    response = Web.Contents(url, [
        Headers = [#"Authorization"="Bearer YOUR_TOKEN"],
        ManualStatusHandling = {200}  // Ensure you can capture the full response metadata
    ]),

    // Extract the 'X-Total-Count' header from the response metadata
    headers = Value.Metadata(response)[Headers],
    totalCount = headers[#"X-Total-Count"],

    // Optional: Convert to number if needed
    totalCountAsNumber = Number.FromText(totalCount)
in
    totalCountAsNumber

@ariannequon,

Good Afternoon!

I’m not sure how PowerBI works behind the scenes, but we saw this when we were building some of our integrations. We had to move awake from “Invoke-RestMethod” calls to “Invoke-WebRequest” calls in order to see the desired headers.

Not sure if PowerBi has some configuration where you can make similar changes.

Thanks!

Hi Ousmane, thanks for your reply! The query suggested is the exact query I was using. The only headers returned are as follows