cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Resolver IV
Resolver IV

Creating a custom connector - returns function instead of json

I'm in the process of creating a custom connector for the Australian ABN Lookup service. The issue I am running into is that the service returns the results wrapped in a callback function 

callback({"Abn":"","AbnStatus":"","Acn":"","AddressDate":null,"AddressPostcode":"","AddressState":"","BusinessName":[],"EntityName":"","EntityTypeCode":"","EntityTypeName":"","Gst":null,"Message":"Search text is not a valid ABN or ACN"})

I was wondering if anyone has come across a way to remove the callback section of the string in the connector so that valid JSON is returned to the flow

 

My other option with the lookup service is to return XML but I believe that this will cause other issues

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Creating a custom connector - returns function instead of json

Hi @Gareth1 ,

 

I'm afraid that it is not easy to handle it in the custom connector.

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Highlighted
Super User
Super User

Re: Creating a custom connector - returns function instead of json

Hi @Gareth1 

 

You could do the replace function to remove the callback text. Please see below.

 

image.png

 

The replace expression I used above is

 

replace(replace(variables('CallbackJSON'),'callback(',''),')','')
 
Thanks


Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Highlighted
Community Support
Community Support

Re: Creating a custom connector - returns function instead of json

Hi @Gareth1 ,

 

I have made a test on my side and @abm 's solution is work, you could also take a try with substring() function, the screenshot of the flow as below:

1.png

The expression in the Compose 3 as below:

substring(outputs('Compose'),9,sub(length(outputs('Compose')),10))

 

Flow would run successfully as below:

2.png

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 
Highlighted
Resolver IV
Resolver IV

Re: Creating a custom connector - returns function instead of json

Hi @v-alzhan-msft 

I ended up using your suggestion in case there are any brackets in the response that should be in there (such as company names)

 

I was hoping to handle this in a custom connector so that it could easily be shared by end users, however I could not find anything for this. The closest I could find was the policies however this seems a bit limited at the moment and doesn't have anything that I think might work here

Highlighted
Community Support
Community Support

Re: Creating a custom connector - returns function instead of json

Hi @Gareth1 ,

 

I'm afraid that it is not easy to handle it in the custom connector.

 

Best regards,

Alice       

 

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Resolver IV
Resolver IV

Re: Creating a custom connector - returns function instead of json

Hi @v-alzhan-msft 

I thought that might have been the case

Thanks for your help

Helpful resources

Announcements
firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Kudoed Authors
Users online (6,873)