Forum Discussion

KaiquePassaros's avatar
KaiquePassaros
New Member
1 year ago

Credential error - Connecting Power BI to a Notion API

Hello everyone! I have a problem with updating a dataset that is connected to the NOTION platform via API.

I am trying to register a Web API data source. It works perfectly in Power BI Desktop. However, in PBI Service, I am receiving the error below.

Failed to update data source credentials: Web.Contents failed to get contents from 'https://api.notion.com/v1/databases/d87aa5a759424f739ba9168d68c9710c/query' (400): Bad Request

Activity ID: 2c8d4210-535b-429b-878f-fcf8c7863b84
Request ID: 84980ab1-bb5f-a72b-0ada-d2cd349dc1f2
Status Code: 400
Time: Thu Dec 19 2024 15:35:56 GMT-0300 (Brasília Standard Time)
Service Version: 13.0.24766.39
Client Version: 2411.3.21980-train
Cluster URI: https://wabi-brazil-south-b-primary-redirect.analysis.windows.net/

Can you help me make the data update available online?

2 Replies

  • I'm using the following code, in anonymous model it works fine, but when I put it in a gateway for update it says that it is not possible to obtain authentication, as presented previously. Code:

     

     

    let
        notion_url = "https://api.notion.com/v1/databases/" & Database_ID_Eventos & "/query",
        notion_req = 
            Web.Contents(
                notion_url, 
                [
                    Headers = [
                        #"Content-Type" = "application/json",
                        #"Notion-Version" = "2022-06-28",
                        Authorization=" Bearer "& AppToken_Marketing
                    ],
                    Content = Json.FromValue([])
                ]),
            notion_res = Json.Document(notion_req),
        results = notion_res[results]
    in
        results