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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.