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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
ihavequestionto
Frequent Visitor

Invalid Connection Credentials When Adding API to On‑premises Data Gateway

Hello,

When adding the API https://api.mktzap.com.br/company/:company_id/historycontact  to my On‑premises Data Gateway, I received the following error:

Cannot refresh connection credentials. Invalid connection credentials.
Details: TIFGVTN-FILE: The credentials provided for the Web source are invalid. (Source at https://api.mktzap.com.br/company/3844/historycontact .)

Please have this information on hand if you decide to open a support ticket: Session ID: 58c075f4-8bf0-4050-a8b1-d603659a3872; RequestId: 510de280-d8c3-4798-a149-e3bdadf0ee3b; Cluster URI: https://api.powerbi.com ; Status Code: 400; Time: Tue Apr 22 2025 08:40:20 GMT-0300 (Brasilia Standard Time).

However, when I added a different endpoint (https://api.mktzap.com.br/company-channels/:company_id ) using the exact same settings, I had no issues.

Here is the public API documentation I’m using: https://apidoc.mktzap.com.br/ 

How can I add the /company/:company_id/historycontact endpoint to the gateway so that I can successfully refresh my reports?

1 ACCEPTED SOLUTION

Power BI Gateway Data Refresh Issue Resolution
Troubleshooting Steps
During a support call with Microsoft, assistance was provided and various tests were conducted to diagnose the issue.
The solution involved creating a Generation 1 (Gen1) dataflow in Power BI. In this dataflow, a table was created to store the token generation link.
The M code used in Power Query in Power BI Desktop was copied and pasted into the dataflow to enable data retrieval via the alternate link (this alternate link had been preventing the on-premises data gateway from refreshing data in the Power BI Service).
Once the dataflow connection was added in the on-premises data gateway, the Power BI Service scheduled refresh was able to update the data successfully.

View solution in original post

13 REPLIES 13
v-pnaroju-msft
Community Support
Community Support

Hi ihavequestionto,

Thank you for the update and sharing your insights and approach in resolving the issue.

We kindly request you to mark your response as the accepted solution, as this will help other community members find answers to similar challenges more efficiently.Please continue leveraging the Fabric Community for any further assistance with your queries.

Thank you.

v-pnaroju-msft
Community Support
Community Support

Hi ihavequestionto,

We are following up to see if your query has been resolved. Should you have identified a solution, we kindly request you to share it with the community to assist others facing similar issues.

If our response was helpful, please mark it as the accepted solution and provide kudos, as this helps the broader community.

Thank you.

Power BI Gateway Data Refresh Issue Resolution
Troubleshooting Steps
During a support call with Microsoft, assistance was provided and various tests were conducted to diagnose the issue.
The solution involved creating a Generation 1 (Gen1) dataflow in Power BI. In this dataflow, a table was created to store the token generation link.
The M code used in Power Query in Power BI Desktop was copied and pasted into the dataflow to enable data retrieval via the alternate link (this alternate link had been preventing the on-premises data gateway from refreshing data in the Power BI Service).
Once the dataflow connection was added in the on-premises data gateway, the Power BI Service scheduled refresh was able to update the data successfully.

v-pnaroju-msft
Community Support
Community Support

Hi ihavequestionto,

We wanted to check in regarding your query, as we have not heard back from you. If you have resolved the issue, sharing the solution with the community would be greatly appreciated and could help others encountering similar challenges.

If you found our response useful, kindly mark it as the accepted solution and provide kudos to guide other members.

Thank you.

Hello, unfortunately I haven’t been able to run the tests yet because of work, but I am extremely grateful for the response. And yes, I will let you know after I complete the tests.

v-pnaroju-msft
Community Support
Community Support

Hi ihavequestionto,

We have not received a response from you regarding the query and were following up to check if you have found a resolution. If you have identified a solution, we kindly request you to share it with the community, as it may be helpful to others facing a similar issue.

If you find the response helpful, please mark it as the accepted solution and provide kudos, as this will help other members with similar queries.

Thank you.

v-pnaroju-msft
Community Support
Community Support

Thankyou, @lbendlin, for your response.

Hi ihavequestionto,

We appreciate your inquiry submitted through the Microsoft Fabric Community Forum.

As per my understanding, the issue arises because Power BI Service and Gateway require a valid and reachable Base URL during data refresh. In your case, accessing only api.mktzap.com.br/ returns a "404 Not Found" error, which leads to the gateway authentication failure. While Power BI Desktop may sometimes handle this scenario more leniently, the Service necessitates a successful connection even to the base URL.

Kindly follow the steps below, which may help to resolve the issue:

  1. Update your API connection so that the Base URL points to a valid path—for example, api.mktzap.com.br/company/ instead of the root URL alone.
  2. Use the RelativePath and Query options to append the specific endpoint (such as /historycontact) and any query parameters like x-page.
  3. Ensure that in Power BI Service, the Authentication Method is set to Anonymous (particularly if you are using Bearer tokens in the headers) and the Privacy Level is set to None.

 

If you find our response helpful, kindly mark it as the accepted solution and provide kudos. Your support will be beneficial to other community members encountering similar queries.

Thank you.

lbendlin
Super User
Super User

there is no need to add the historycontact endpoint. Implement a custom action in your connector that adds it as a relative parameter.

But how do I do this?

This API only requires these two parameters:

Authorization: Company access token (Bearer token)

x-page (optional): Page number to return

Sorry, I thought you were using a custom connector.

 

Please follow the documentation. Use RelativePath and Query parameters. https://learn.microsoft.com/en-us/powerquery-m/web-contents#example-1

So it works in Power BI Desktop, but when adding this link to the gateway, in the Power BI Service it fails — it doesn’t allow me to add it and always returns an error when configuring the connection.

what is the error message?

Using RelativePath, now the connection I’m trying to create is for this link: https://api.mktzap.com.br/.

When connecting as Anonymous and setting Privacy level to None, the following error is returned:

Unable to update connection credentials. Unable to connect to the data source. Either the data source is inaccessible, a connection timeout occurred, or the data source credentials are invalid. Please verify the data source configuration and contact a data source administrator to troubleshoot this issue.

Details: TIFGVTN-FILE: Falha no Web.Contents ao obter conteúdo de 'https://api.mktzap.com.br/' (404): Not Found Please have this information handy if you choose to create a support ticket. Session Id: faaa0463-fab0-456d-b0a7-ae2a5ac9b74e RequestId: 68946402-739e-4a11-927e-a2e14b5a3068 Cluster URI: https://api.powerbi.com Status code: 400 Time: Thu Apr 24 2025 16:32:40 GMT-0300 (Hora padrão de Brasília)



Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

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