You are viewing limited content. For full access, please sign in.

Question

Question

Workflow Web Request URI Ampersand

asked on June 26, 2018 Show version history

We have a web request in workflow that accesses a custom web API. One of the parameters used in the Web Request URI can potentially contain ampersands. We are using the Encode URL function to replace ampersands with %26, but when the Web Request actually runs, it seems to be reverting the string back to an ampersand so our web api is receiving incorrect parameters. Is there any way to prevent the web request from changing it back to an ampersand?

 

 

0 0

Replies

replied on June 26, 2018

In my experience a Web Request URI shouldn't have a problem with ampersands. I have a web request pointing to one of our APIs with the & right in the URI as-is and it works correctly.

0 0
replied on June 26, 2018

Hi Jason, thanks for your response. The ampersands that separate the query string parameters are fine. My problem here is when the parameters themselves have ampersands in them. For example, one of the parameters above is VendorNumber, which could be AT&T. The & in AT&T needs to be encoded.

0 0
replied on June 26, 2018 Show version history

Gotcha, that is indeed an interesting problem. I don't think this is necessarily problem with Workflow but rather a problem with using an ampersand as part of a value when it is used to separate value pairs in the URL.

I just tested including an "&" in a URL API call outside of Workflow (using Postman) and regardless of whether I put & or %26 it still encountered an error because the %26 still translates to "&" and the API is using that to identify parameter/value pairs.

UPDATE: So %26 does work in a browser. My guess is that applications like Workflow and Postman (in some cases) may be converting it back when making the call and that is the source of the problem.

1 0
replied on June 26, 2018

It works fine for me when using a browser. Using a & in the vendor number breaks it, but using %26 just fine. Workflow seems to be un-encoding the %26 back to &

0 0
replied on June 26, 2018

Yea, I ran some more tests and Workflow does seem to un-encode it no matter what I try.

2 0
replied on June 26, 2018

Could you check the version of the .Net 4 Framework you have installed?

0 0
replied on June 26, 2018

4.5.2

0 0
replied on June 26, 2018

This does not really fix the problem with workflow web requests, but I ended up using a work-around. I now replace "&" with "{ampersand}". I changed my web api to accept the {ampersand} and convert it back to &.

0 0
replied on June 26, 2018

That's a good workaround since it is your own API, but I agree it doesn't really fix the issue. I know in our case, and likely many others, some of the APIs we call are for third party applications that we cannot modify.

0 0
replied on June 26, 2018

Yup. Hoping for a laserfiche fix. I'm surprised no one has posted on this issue before.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.