cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HA
Level: Powered On

Bug: PowerApps is URL encoding API calls to custom connectors

I've created a custom connector that works perfectly from the Test tab and also from Postman.  It doesn't work from within a PowerApp, resulting in a 404 Resource Not Found error.  After plenty of searching and investigation, here's what I've found.

 

PowerApps include an extra step that the Test tab does not take into account.  While the Test tab sends a GET HTTP request directly to the connector/API to prove it's functioning property, PowerApps performs a POST to "invoke" first, which in turn sends the GET HTTP request to the connector/API.  The POST includes several "x-ms-" fields, but the issue lies within "x-ms-request-url".  This field contains the url to the connector/API, and that url is being percent-encoded by PowerApps.  For example, single quotes are replaced with %27, left parentheses with %28, and right parentheses with %29.

 

The connector is expecting /lists/getbytitle('Documents') for example but instead is receiving /lists/getbytitle%28%27Documents%27%29, which results in the 404 error.

 

To prove the issue lies specifically in the unwanted encoding of x-ms-request-url, I performed the same failing POST as PowerApps using Postman and received the same 404 error.  Within Postman, I modified x-ms-request-url by eliminating the percent encoding and received the expected 200 response with valid results.

 

Either PowerApps should avoid encoding the url in x-ms-request-url, or the connector/connection should be modified to gracefully accept the percent encoded url.  I would love to see this one get fixed in the near future so REST API's with parentheses are fully supported.  Or...clearly document that they are not.

2 REPLIES 2
Community Support Team
Community Support Team

Re: Bug: PowerApps is URL encoding API calls to custom connectors

Hi @HA ,

Could you please share a bit more about the REST API that you used within your custom connector? Is it the SharePoint REST API?

 

Currently, I could not reproduce your issue on my side, if you would like this feature to be fixed, please consider submit an idea to PowerApps Ideas Forum:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

In addition, if use SharePoint REST API to create your custom connector, as an alternative solution, I think the "Send an HTTP request to SharePoint" action of SharePoint connector in Microsoft Flow could achieve your needs.

The "Send an HTTP request to SharePoint" action used to execute SharePoint REST APIs. More details about executing "Send an HTTP request to SharePoint" action, please check the following blog:

https://veenstra.me.uk/2018/08/28/sharepoint-microsoft-flow-maintain-list-details-for-no-code-develo...

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
HA
Level: Powered On

Re: Bug: PowerApps is URL encoding API calls to custom connectors

Thank you for the suggestion to post to PowerAppsIdeas.  I have reposted here:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/Bug-Custom-Connector-API-call-is-URL-encoded/idi...

 

The connector should function properly from PowerApps without having to leverage Flow.  You are correct...for this case it's a simple test using the Office 365 SharePoint Online API.  However, others attempting to leverage API's with parentheses, for example, are going to encounter the same issue.  I tested a bit more, and the custom connector works from Flow.  So, it currently works from the Test tab, Postman, and Flow.  It's only PowerApps that is introducing the issue.

 

Thanks again...I do appreciate all of your suggestions.