cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

encodeUricomponent returns non-specific error. Stumped.

Hi,

 

I'm trying use HTTP request POST method to send HTML code to an API. The API requires the "x-www-form-urlencoded" body type. I'm able to adjust the headers and format the request body properly, except Flow refuses to url encode my html.

I get the following error message:

error.PNG

This is what my HTTP request looks like.

http.PNG

The 'Get_attachment_content_2' returns HTML.

 

Anyone know what I'm doing wrong? Is this just a bug?

When I paste my HTML into a webform url-encoder, there aren't any errors. 

1 ACCEPTED SOLUTION

Accepted Solutions
Anonymous
Not applicable

Yes, I tried that but the content was not being Url encoded automatically. The HTTP action seems only designed to handle application/json content type requests.

 

My solution was to make my own url-encoding function:

 

replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(body('Get_attachment_content_2'),'%','%25'),'&nbsp;','%a0'),'!','%21'),'#','%23'),'&','%26'),'''','%27'),'(','%28'),')','%29'),'*','%2A'),'+','%2b'),',','%2c'),'/','%2f'),':','%3a'),';','%3b'),'=','%3d'),'?','%3F'),'@','%40'),'[','%5B'),']','%5d'),'$','%24'),' ','+'),'"','%22'),'-','%2d'),'.','%2e'),'<','%3c'),'>','%3e'),'\','%5e'),'_','%5f'),'`','%60'),'{','%7b'),'}','%7d'),'|','%7c'),'~','%7e')
 
So I managed to make it work.

View solution in original post

2 REPLIES 2
v-yuazh-msft
Community Support
Community Support

Hi @Anonymous,

 

Have you take a try to don't use the expression encodeUriComponent and just use the expression 

body('Get_attachment_content_2')  ?

 

Best regards,

Alice

Anonymous
Not applicable

Yes, I tried that but the content was not being Url encoded automatically. The HTTP action seems only designed to handle application/json content type requests.

 

My solution was to make my own url-encoding function:

 

replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(body('Get_attachment_content_2'),'%','%25'),'&nbsp;','%a0'),'!','%21'),'#','%23'),'&','%26'),'''','%27'),'(','%28'),')','%29'),'*','%2A'),'+','%2b'),',','%2c'),'/','%2f'),':','%3a'),';','%3b'),'=','%3d'),'?','%3F'),'@','%40'),'[','%5B'),']','%5d'),'$','%24'),' ','+'),'"','%22'),'-','%2d'),'.','%2e'),'<','%3c'),'>','%3e'),'\','%5e'),'_','%5f'),'`','%60'),'{','%7b'),'}','%7d'),'|','%7c'),'~','%7e')
 
So I managed to make it work.

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Difinity Conference 2022

Difinity Conference 2022

Register today for two amazing days of learning, featuring intensive learning sessions across multiple tracks, led by engaging and dynamic experts.

European SharePoint Conference

European SharePoint Conference

The European SharePoint Conference returns live and in-person November 28-December 1 with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Users online (2,318)