Forum Discussion

katushka_enko's avatar
katushka_enko
Frequent Visitor
3 years ago
Solved

custom connector

Hello! I'm new to creating connectors, and I'm asking for your help! Previously, I wrote a request to share the experience of connecting to SendPulse, and now I ask to share the experience (pitfalls) of creating a connector.  What exactly is needed to configure a custom connector in Power BI?

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi katushka_enko ,

     

    To create a custom connector in Power BI, you can use the Power Query SDK to create a data connector that can be added to the Get Data menu. Below articles will help you understand.

     

    Create a Power Query custom data connector in 10 minutes

     

    Building a custom connector for Power BI that supports OAuth2 to visualize my wellness data

     

    Custom Data Connector: How to Deploy and Test

     

    Best Regards,

    Stephen Tao

     

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

    • Servando's avatar
      Servando
      Regular Visitor

      I have this code I need to build a custom connector in order to update a PBI report daily it connects throug a basic auth and gets the token then inster the token on the other API to get the report info could you help me this is my code..

       

      section Connector_Monthly;

      [DataSource.Kind="Connector_Monthly", Publish="Connector_Monthly.Publish"]
      shared Connector_Monthly.Contents = (date as date) =>
          let
              // Define the login URL and credentials
              username = "xxxxxxxx",
              password = "xxxxxxx",
              authHeader = "Basic " & Binary.ToText(Text.ToBinary(username & ":" & password), BinaryEncoding.Base64),

              // Make the login request
              loginResponse = Json.Document(Web.Contents(loginUrl, [Headers=[Authorization=authHeader]])),
              token = loginResponse[Data][token], // Extract the token from the JSON response

              // Define the report URL with a dynamic date
              formattedDate = Date.ToText(date, "yyyy-MM-dd"),
              reportUrl = "https://xxxxxxx.com/vesb/api/public/vpos/Report/monthlySalesExt/" & formattedDate,

              // Get the report data
              reportResponse = Json.Document(Web.Contents(reportUrl, [Headers=[Authorization="Bearer " & token]]))
          in
              reportResponse;

      // Data Source Kind description
      Connector_Monthly = [
          Authentication = [
              UsernamePassword = []
          ],
          Label = Extension.LoadString("DataSourceLabel")
      ];

      // Data Source UI publishing description
      Connector_Monthly.Publish = [
          Beta = true,
          Category = "Other",
          ButtonText = { Extension.LoadString("ButtonText"), Extension.LoadString("ButtonTooltip") },
          LearnMoreUrl = "https://example.com",
          SourceImage = Connector_Monthly.Icons,
          SourceTypeImage = Connector_Monthly.Icons
      ];

      Connector_Monthly.Icons = [
          Icon16 = {
              Extension.Contents("Connector_Monthly16.png"),
              Extension.Contents("Connector_Monthly20.png"),
              Extension.Contents("Connector_Monthly24.png"),
              Extension.Contents("Connector_Monthly32.png")
          },
          Icon32 = {
              Extension.Contents("Connector_Monthly32.png"),
              Extension.Contents("Connector_Monthly40.png"),
              Extension.Contents("Connector_Monthly48.png"),
              Extension.Contents("Connector_Monthly64.png")
          }
      ];
      • Servando's avatar
        Servando
        Regular Visitor

        Failed to run the query due to Error: Unable to determine data source from expression. This may indicate unexpected or invalid parameters to your data source function call.