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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
thialessandro
Frequent Visitor

API Connection

Hello,

 

I need to connect in API with method POST and authorization token, but the response is 404 or 400.

I tried with M language:

 

let
Json = Json.FromValue({[idType= "Authorization", idValue= "KEY123"]}),
Source = Json.Document(Web.Contents("https://apiintegracao.milvus.com.br/api/chamado/listagem", [Headers=[#"Content-Type"="application/json"]]))
in
Source

 

And I tried with Web Data Source, and not works?

thialessandro_0-1679429489985.png

The API link I'm trying to connect:

https://developers.milvus.com.br/#api-Chamado-listagemChamados

 

Anyone can help me, please?

 

Sorry about my level English.

3 REPLIES 3
JanainaValim
New Member

Use a Python script being read directly by Power BI to query the API. Refer to the API https://developers.milvus.com.br/#api-Chamado-listagemChamados documentation to modify the parameters and the filter body ('filtro_body')

import requests
import pandas as pd
import json

url = "https://apiintegracao.milvus.com.br/api/chamado/listagem"

# Add Query Param to the URL
url += "?total_registros=1000"

payload = json.dumps({
"filtro_body": {
"status": 4,
}
})
headers = {
'Content-Type': 'application/json',
'Authorization': '123token'
}

response = requests.request("POST", url, headers=headers, data=payload)

# Parse the JSON response
data = response.json()

# Check if the response was successful
if 'lista' in data:
# Convert the response data to a DataFrame
df = pd.DataFrame(data['lista'])

# Select and organize columns
columns_to_select = ["codigo", "cliente", "contato", "categoria_primaria", "categoria_secundaria", "tecnico", "total_horas", "data_criacao", "data_solucao", "servico_realizado"]
if all(col in df.columns for col in columns_to_select):
df = df[columns_to_select]

# Format date columns, if necessary
df["data_criacao"] = pd.to_datetime(df["data_criacao"])
df["data_solucao"] = pd.to_datetime(df["data_solucao"])

# Display DataFrame in tabular format
print(df.to_string(index=False))
else:
print("Some specified columns are not present in the DataFrame returned by the API.")
# Add logic here to handle the situation of missing columns, if necessary.
else:
print("Error in API response:", data)

thialessandro
Frequent Visitor

I tried, but not works too.

 

Now, I'm trying this way:

 

 

 

let
content = "{""filtro_body"": ""123""}",


Source = Json.Document(Web.Contents("https://apiintegracao.milvus.com.br/api/chamado/listagem",
                       [Headers=[#"Authorization"="token", 
                                 #"apikey" = "****", 
                                 #"filtro_body" = "{}",
                                 #"ContentType"="application/json"], 
                                  
                        ManualStatusHandling = {404, 400},
                        
                       
                        Content=Text.ToBinary(content)]))

in
Source

 

 

 

And not works too, but show me another message "Parameter not informed in the request body => {filtro_body}"

 

I added the parameter 'filtro_body", but the message remains

 

karthiknc
Frequent Visitor

Authorization also needs to be added to the Header. Please try again after making the header changes

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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