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
 WHAT’S NEXT AT MICROSOFT IGNITE 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Users online (3,294)