<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Custom Connector: changing function parameters from optional to required creates dataformat.error in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Connector-changing-function-parameters-from-optional-to/m-p/2987859#M40461</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have developped a custom connector which works fine - as long as I define my function parameters as optional parameters.&lt;/P&gt;&lt;P&gt;As soon as I change to parameters to required, I get an "Unexpected Exception": "[DataFormat.Error] We found extra characters at the end of JSON input".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Details:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Definiton of main function of the custom connector, which works perfectly fine:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[DataSource.Kind="MS_Power_BI_Ungerboeck", Publish="MS_Power_BI_Ungerboeck.Publish"]
shared MS_Power_BI_Ungerboeck.Contents = (optional apiUser as text, optional apiKey as text, optional apiSecret as text, optional apiUrl as text, optional apiTimeout as number) =&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Change the first parameter (or all) to required and the error occurs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[DataSource.Kind="MS_Power_BI_Ungerboeck", Publish="MS_Power_BI_Ungerboeck.Publish"]
shared MS_Power_BI_Ungerboeck.Contents = (apiUser as text, optional apiKey as text, optional apiSecret as text, optional apiUrl as text, optional apiTimeout as number) =&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The test function which I use for testing the custom connector looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Use this file to write queries to test your data connector
let
    result = MS_Power_BI_Ungerboeck.Contents("POWBI","ab430fcb-144f-45e1-ab54-447bd22aac5e","d68d7c9f-564e-378f-a14b-b2c0586c68da","https://hostname.mydomain.com/api/v1/Accounts/10?search=AccountCode%20eq'SMITH'",10)
in
    result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only change which makes it work or creates the error is to have one or none required parameters:&lt;/P&gt;&lt;P&gt;it works fine when all parameters are declared as optional.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It fails when at least one parameter is required.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I checked lots of examples and documentation about function parameters, but could not find the reason for that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is highly appreaciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank,&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;</description>
    <pubDate>Sun, 25 Dec 2022 10:58:34 GMT</pubDate>
    <dc:creator>thomashohm</dc:creator>
    <dc:date>2022-12-25T10:58:34Z</dc:date>
    <item>
      <title>Custom Connector: changing function parameters from optional to required creates dataformat.error</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Connector-changing-function-parameters-from-optional-to/m-p/2987859#M40461</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have developped a custom connector which works fine - as long as I define my function parameters as optional parameters.&lt;/P&gt;&lt;P&gt;As soon as I change to parameters to required, I get an "Unexpected Exception": "[DataFormat.Error] We found extra characters at the end of JSON input".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My Details:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Definiton of main function of the custom connector, which works perfectly fine:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[DataSource.Kind="MS_Power_BI_Ungerboeck", Publish="MS_Power_BI_Ungerboeck.Publish"]
shared MS_Power_BI_Ungerboeck.Contents = (optional apiUser as text, optional apiKey as text, optional apiSecret as text, optional apiUrl as text, optional apiTimeout as number) =&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Change the first parameter (or all) to required and the error occurs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[DataSource.Kind="MS_Power_BI_Ungerboeck", Publish="MS_Power_BI_Ungerboeck.Publish"]
shared MS_Power_BI_Ungerboeck.Contents = (apiUser as text, optional apiKey as text, optional apiSecret as text, optional apiUrl as text, optional apiTimeout as number) =&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The test function which I use for testing the custom connector looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;// Use this file to write queries to test your data connector
let
    result = MS_Power_BI_Ungerboeck.Contents("POWBI","ab430fcb-144f-45e1-ab54-447bd22aac5e","d68d7c9f-564e-378f-a14b-b2c0586c68da","https://hostname.mydomain.com/api/v1/Accounts/10?search=AccountCode%20eq'SMITH'",10)
in
    result&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The only change which makes it work or creates the error is to have one or none required parameters:&lt;/P&gt;&lt;P&gt;it works fine when all parameters are declared as optional.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It fails when at least one parameter is required.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I checked lots of examples and documentation about function parameters, but could not find the reason for that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help is highly appreaciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank,&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;</description>
      <pubDate>Sun, 25 Dec 2022 10:58:34 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Connector-changing-function-parameters-from-optional-to/m-p/2987859#M40461</guid>
      <dc:creator>thomashohm</dc:creator>
      <dc:date>2022-12-25T10:58:34Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Connector: changing function parameters from optional to required creates dataformat.erro</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Connector-changing-function-parameters-from-optional-to/m-p/2988161#M40462</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/491015"&gt;@thomashohm&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is the error message the same when you set all parameters to required?&lt;/P&gt;
&lt;P&gt;Besides, h&lt;SPAN&gt;ere’s one of the point provided in the Microsoft documentation&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://learn.microsoft.com/en-us/power-query/handling-authentication#data-source-paths" target="_blank"&gt;Handling authentication for Power Query connectors - Power Query | Microsoft Learn&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope it would help you.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;Best Regards,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;Jianbo Li&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="background: white; margin: 7.5pt 0in 0in 0in;"&gt;&lt;SPAN&gt;If this post&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;helps&lt;/I&gt;&lt;/STRONG&gt;, then please consider&amp;nbsp;&lt;STRONG&gt;&lt;I&gt;Accept it as the solution&lt;/I&gt;&lt;/STRONG&gt;&amp;nbsp;to help the other members find it more quickly.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Dec 2022 02:48:21 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Connector-changing-function-parameters-from-optional-to/m-p/2988161#M40462</guid>
      <dc:creator>v-jianboli-msft</dc:creator>
      <dc:date>2022-12-26T02:48:21Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Connector: changing function parameters from optional to required creates dataformat.erro</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Connector-changing-function-parameters-from-optional-to/m-p/2993107#M40507</link>
      <description>&lt;P&gt;Hi Jianbo Li,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;thanks for your reply.&lt;/P&gt;&lt;P&gt;The error still is the same when I change all parameters to required.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Even when I create a new project with the hello world default example and just change the parameter to be mandatory by removing the word "optional", this error occurs.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It might be something completely independant from my own code.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will accept this situation as not resolvable by myself and leave all parameters as optional.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks anyways for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BR&lt;/P&gt;&lt;P&gt;Thomas&lt;/P&gt;</description>
      <pubDate>Thu, 29 Dec 2022 10:33:27 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Connector-changing-function-parameters-from-optional-to/m-p/2993107#M40507</guid>
      <dc:creator>thomashohm</dc:creator>
      <dc:date>2022-12-29T10:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Custom Connector: changing function parameters from optional to required creates dataformat.erro</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Custom-Connector-changing-function-parameters-from-optional-to/m-p/2994894#M40529</link>
      <description>&lt;P&gt;Hello, i have the same problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Did you found a solution?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And i have another question, is it possible to change the value of this parameters in Power BI once custom connector is loaded?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 30 Dec 2022 13:47:04 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Custom-Connector-changing-function-parameters-from-optional-to/m-p/2994894#M40529</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2022-12-30T13:47:04Z</dc:date>
    </item>
  </channel>
</rss>

