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
mtoarantes
Regular Visitor

Microsoft Fabric Notebook - API - WABI

Endpoint URL - wabi-east-us-redirect.analysis.windows.net/metadata/monitoringhub

Hello Everyone, 

 

I would like to know how can i get access in this endpoint cause when i try to connect i get a message error about Timeout ..

5 REPLIES 5
mtoarantes
Regular Visitor

Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x754daa1eed50>, 'Connection to wabi-us-east-redirect.analysis.windows.net timed out. (connect timeout=800)')': /metadata/monitoringhub/histories?endTime=2025-02-21T15%3A27%3A49.520096Z&startTime=2025-02-01T00%3A00%3A00Z&limit=50000

Anonymous
Not applicable

Hi, @mtoarantes 
Thank you for your detailed response. Based on my search, I personally recommend using the service principal method to call the following types of REST APIs, as this is our preferred approach.

 

POST https://api.fabric.microsoft.com/v1/workspaces/{workspaceId}/items

 

vlinyulumsft_6-1740385862688.png

Items - REST API (Core) | Microsoft Learn

 

Below are screenshots and links related to issues with similar port calls:

vlinyulumsft_5-1740385835222.png

vlinyulumsft_4-1740385823767.png

For more details, please refer to:

Solved: Power BI API - return unexpexted result - Microsoft Fabric Community

Solved: Re: Is there anyone familiar with: https://wabi-us... - Microsoft Fabric Community

Solved: Getting Token for API Dataflow Gateway Binding - Microsoft Fabric Community

 

 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

mtoarantes
Regular Visitor

def crear_sesion():
    """Crea una sesión de requests con reintentos"""
    sesion = requests.Session()
    reintentos = Retry(total=3, backoff_factor=5, status_forcelist=[502, 503, 504])
    adaptador = HTTPAdapter(max_retries=reintentos)
    sesion.mount('http://', adaptador)
    sesion.mount('https://', adaptador)
    return sesion

SESION = crear_sesion()

def invocar_api_fabric(metodo, uri, params=None, payload=None):
    """Invoca la API de Fabric y maneja la paginación si es necesario"""
    token = obtener_token()
    headers = {
        "Authorization": f"Bearer {token}",
        "Content-Type": "application/json"
    }
    
    todos_los_datos = []
    token_continuacion = None

    try:
        while True:
            if token_continuacion:
                params['continuationToken'] = token_continuacion
            
            url = f"https://{API_ENDPOINT}/{uri}"
            respuesta = SESION.request(metodo, url, headers=headers, params=params, json=payload, timeout=800)
            respuesta.raise_for_status()
            datos_respuesta = respuesta.json()
            
            if isinstance(datos_respuesta, list):
                todos_los_datos.extend(datos_respuesta)
            else:
                todos_los_datos.extend(datos_respuesta.get('value', []))
                token_continuacion = datos_respuesta.get('continuationToken')
            
            if not token_continuacion:
                break

        return todos_los_datos
mtoarantes
Regular Visitor

Hello @Anonymous ,

Thank you for the answer, bellow im putting the code about the API 

 

API_ENDPOINT = "wabi-east-us-redirect.analysis.windows.net"
 
def obtener_token():
return mssparkutils.credentials.getToken("pbi")
 
def cargar_datos(engine, tipo_carga😞
    """Carga los datos de manera histórica o incremental según el tipo de carga"""
    if tipo_carga == "historical":
        print("Iniciando carga histórica")
        fecha_inicio = datetime(1970, 1, 1)
        fecha_fin = datetime.utcnow()
    else:
        print("Iniciando carga incremental")
        max_start_time = obtener_max_start_time(engine)
        if max_start_time is None:
            print("No se encontró fecha máxima. Realizando carga histórica.")
            cargar_datos(engine, "historical")
            return
        fecha_inicio = max_start_time
        fecha_fin = datetime.utcnow()

    uri = "metadata/monitoringhub/histories"
    params = {
        "endTime": fecha_fin.isoformat() + 'Z',
        "startTime": fecha_inicio.isoformat() + 'Z',
        "limit": 50000,
    }

    datos = invocar_api_fabric("GET", uri, params=params)
    if 'error' in datos:
        print(f"Error al obtener datos: {datos['error']}")
        return

    print(f"Datos obtenidos: {len(datos)} registros")
    df = normalizar_datos(datos)
    df_refinado = refinar_datos(df)

    if tipo_carga == "incremental":
        df_existente = obtener_datos_existentes(engine, fecha_inicio)
        df_refinado_existente = refinar_datos(df_existente)
        df_refinado = pd.concat([df_refinado_existente, df_refinado]).drop_duplicates(keep=False)

    guardar_dataframe_en_bd(df_refinado, engine, 'logs')
    print(f"Finalizada la carga {tipo_carga}")
 
 
Anonymous
Not applicable

Hi, @mtoarantes 
Thanks for reaching out to the Microsoft fabric community forum.

 Are you encountering errors when connecting to the Lakehouse via the SQL Analytics endpoint? If so, this might be related to the large volume of data causing M language query processing to time out. You can resolve this issue by setting the CommandTimeout. Here are some relevant answers that might help you:

vlinyulumsft_0-1740035475395.png

For more details, please refer to:

Solved: How to set command timeout option - Microsoft Fabric Community

 

If the error occurs during an API call, please check if the API you are using supports Long Running Operations. Here are some relevant document screenshots:

vlinyulumsft_1-1740035475396.png

For more details, please refer to:

Long running operations - Microsoft Fabric REST APIs | Microsoft Learn

Items - Create Item - REST API (Core) | Microsoft Learn

Solved: Re: Not able to connect to Lakehouse SQL endpoint - Microsoft Fabric Community

 

If the issue is with an API call, please share which API call is causing the problem and provide more error details.Of course, if you have any new discoveries or questions, please feel free to get in touch with us.
 

Best Regards,

Leroy Lu

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.