Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin 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.
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:
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
Solved! Go to Solution.
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.
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:
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.
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.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
57 | |
28 | |
25 | |
22 | |
21 |
User | Count |
---|---|
58 | |
45 | |
24 | |
24 | |
18 |