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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

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

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,984)