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
rodrigosk
New Member

Error update power bi webservice - concatenate url

Good afternoon everyone!

I have a query in Power BI, where I have a column with "OrderId".

I have a function that creates a URL using the "OrderId" column.

When this function is called, the data loads normally locally. However, when I try to update the credentials in the Power BI webservice, I get the following error below. Please note that this API endpoint requires me to pass the "OrderId" number. Can someone help me? I've tried a lot of things.

Below is the query

Below error power bi webservice:

Falha ao atualizar as credenciais da fonte de dados: Web.Contents failed to get contents from 'https://api.sienge.com.br/domainexesmple/public/api/v1/purchase-invoices/deliveries-attended?purchas...' (400): Bad RequestOcultar detalhes
ID da atividade:c6561ae7-5a39-4ci6-8b90-c6fc9co02f19
Solicitar ID:47c99539-9382-5796-9843-fe78ed05pdaa
Código de status:400
Hora:Wed May 28 2025 14:27:40 GMT-0300 (Horário Padrão de Brasília)
Versão do serviço:13.0.25965.43
Versão do Cliente:2505.3.24303-train
Cluster URI:https://wabi-brazil-south-b-primary-redirect.analysis.windows.net/

url



let
get_pedido_atendido = (pedidoId as number) =>
let
baseUrl = "https://api.sienge.com.br/domainexemple/public/api/v1/purchase-invoices/deliveries-attended?purchase...",
response = Web.Contents(
baseUrl,
[
RelativePath = "",
Query = [purchaseOrderId = Number.ToText(pedidoId)]
]
),
json = Json.Document(response)
in
json
in
get_pedido_atendido

1 ACCEPTED SOLUTION
Akash_Varuna
Community Champion
Community Champion

Hi @rodrigosk I think it might be because of missing proper API authentication or incorrect parameter formatting. Ensure the API token or credentials are correctly passed using Headers in Web.Contents. Verify that the pedidoId parameter is properly included in the URL query. Also, confirm the Power BI Service credentials match the API requirements.

View solution in original post

5 REPLIES 5
v-kpoloju-msft
Community Support
Community Support

Hi @rodrigosk,

Thank you for reaching out to the Microsoft fabric community forum. Additionally, thank you to @Akash_Varuna, for his input regarding this issue. I have identified several alternative workarounds that may assist in resolving the thread.

Based on your description, it appears you are using a custom function with Web.Contents to create a dynamic URL utilizing the OrderId. While this approach functions correctly in Power BI Desktop, it results in a 400 (Bad Request) error in the Power BI Service. This issue is commonly encountered with parameterized API calls in the Service.

The Power BI Service requires that URLs provided to Web.Contents be static or predictable. When URLs are
dynamically generated within a function (such as get_pedido_atendido), the Service is unable to validate or cache the URL during refresh, leading to credential or request errors.

To ensure compatibility with the Power BI Service, please follow these guidelines:

  • Use a static base URL in Web.Contents
  • Pass any parameters (such as OrderId) through the Query record
  • Avoid string concatenation when constructing the URL

Below is an example of how to correctly structure the query:

let

    // Replace this with your actual source table

    OrderTable = #table({"OrderId"}, {{12345}, {67890}}),



    // Add API response column using static base URL

    GetData = Table.AddColumn(OrderTable, "API_Response", each

        let

            response = Web.Contents(

                "https://api.sienge.com.br", // Static base URL

                [

                    RelativePath = "domainexemple/public/api/v1/purchase-invoices/deliveries-attended",

                    Query = [purchaseOrderId = Text.From([OrderId])]

                ]

            ),

            json = Json.Document(response)

        in

            json

    )

in

    GetData


Ensure that the data source credentials in the Power BI Service are properly configured (Anonymous/OAuth2 as required). Additionally, verify that your gateway is online and correctly set up if you are accessing this API from an on-premises source.

Kindly refer to the below mentioned document for better understanding:
Web.Contents - Power Query M | Microsoft Learn
Data refresh in Power BI - Power BI | Microsoft Learn

If this post helps, then please give us ‘Kudos’ and consider Accept it as a solution to help the other members find it more quickly.

Thank you for using the Microsoft Community Forum.

Hi @rodrigosk,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

Hi @rodrigosk,

I wanted to check if you had the opportunity to review the information provided. Please feel free to contact us if you have any further questions. If my response has addressed your query, please accept it as a solution and give a 'Kudos' so other members can easily find it.
Thank you.

Hi @rodrigosk,

I hope this information is helpful. Please let me know if you have any further questions or if you'd like to discuss this further. If this answers your question, please Accept it as a solution and give it a 'Kudos' so others can find it easily.
Thank you.

Akash_Varuna
Community Champion
Community Champion

Hi @rodrigosk I think it might be because of missing proper API authentication or incorrect parameter formatting. Ensure the API token or credentials are correctly passed using Headers in Web.Contents. Verify that the pedidoId parameter is properly included in the URL query. Also, confirm the Power BI Service credentials match the API requirements.

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.