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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
SammyG
Frequent Visitor

API Data Connector not recognised

Hi all,

 

I have written a custom connector.  Code below.  Which I have saved as a MEZ file in User/documents/PowerBI/custom connectors along with another custom connector (which works fine).  I have amended the security settings on PBI desktop to allow custom connectors and already have one custom connector active on a different project.  Howeve, this connector is nowhere to be found on the 'get Data' list. I can only assume there's something wrong with my code.  But I can't figure out what.

 

Can anyone advise?

 

section ServiceGeeni;

// Define the base URL of the API

// Authentication details (these should be secured appropriately)
client_id = "key_XXXXX";
client_secret = "XXXXXXX";
scope = "keyAPI";

// Define the connector kind
[DataSource.Kind="ServiceGeeni", Publish="ServiceGeeni.Publish"]
shared ServiceGeeni.Contents = () =>
    let
        // Request the access token
        tokenResponse = Json.Document(Web.Contents(tokenUrl, [
            Content = Text.ToBinary("client_id=" & client_id & "&client_secret=" & client_secret & "&scope=" & scope & "&grant_type=client_credentials"),
            Headers = [#"Content-Type" = "application/x-www-form-urlencoded"]
        ])),
        access_token = if Record.HasFields(tokenResponse, "access_token") then tokenResponse[access_token] else error Error.Record("Token Error", "Failed to retrieve token", tokenResponse),

        // Define the request body for the POST request (modify as needed)
        requestBody = "{ \"param1\": \"value1\", \"param2\": \"value2\" }",

        // Call the API with the obtained token using POST method
        apiUrl = baseUrl & "services",
        response = Json.Document(Web.Contents(apiUrl, [
           
            Headers = [Authorization = "Bearer " & access_token, #"Content-Type" = "application/json"],
            Content = Text.ToBinary(requestBody)
        ]))
    in
        response;

// Define how the connector is published
ServiceGeeni.Publish = [
    Beta = true,
    Category = "Other",
    ButtonText = { "Service Geeni API", "Connect to Service Geeni API" },
];
 
Thanks in advance for any help
2 REPLIES 2
SammyG
Frequent Visitor

Hi,

thank you for the reply.  I had already tried all of the above and to no avail.  I have another custom connector working fine so I am wondering if it's something wrong with the actual connector?

 

SammyG

Anonymous
Not applicable

Hi  @SammyG ,

 

Make sure that custom connectors (.mez files) are saved in the correct location. After saving the connector, restart Power BI Desktop to ensure it recognizes the new file.

For example: User/documents/PowerBI Desktop/custom connectors

To use uncertified custom connectors, you can try opening the following option.

File > Options and settings > Options > Security.

Under Data Extensions, select (Not Recommended) Allow any extension to load without validation or warning.

vyangliumsft_0-1720080473003.png

Connector extensibility in Power BI - Power BI | Microsoft Learn

 

This is the related document, you can view this content:

Power BI Connector not showing up in Get Data window | Community (cdata.com)

Custom Connector Icon Not showing in Power BI - Power Platform Community (microsoft.com)
Custom connector development FAQ - Power Query | Microsoft Learn

 

Best Regards,

Liu Yang

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

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.