447
Views
14
Comments
Solved
Any way to avoid URL param of REST request getting URL encoded?
Application Type
Traditional Web
Service Studio Version
11.10.22 (Build 42083)

I have the following REST request containing a '@' character and it would need to stay that way. However, it's getting URL encoded to '%40' - see picture

Any way to prevent this?

I  also tried passing it as a parameter '... /users/{User}' but has the same issue.

2025-03-25 14-32-34
Diogo Barata
Solution

Hi Adam,

I had the same problem.

You can use the OnBeforeRequest event of your REST API to manipulate your URL path. 

Use the DecodeURL action of the HttpUtility extension to remove all the Encoding and assign that value to the CustomizedRequest.URLPath.

2021-01-19 14-07-32
Tom Zhao

Hi Aam,

Can you tell us the detailed error information?

Kind regrads,

2021-07-14 10-21-07
Krunal Vyas

Hello Adam,

Can you try to pass it directly from Input Parameter?

Try to pass @ as a part of input parameter.


Thanks,

Krunal

2021-05-15 11-53-27
Adam Nagy

Thanks for the replies!

The error is 400 and can reproduce it through debugging as well, of course:

 Yes, I tried passing the info through a parameter as well, but have the same problem:

Looks like, inside the "Test" part of the REST editing dialog, it does not URL encode the '@' when sending the request, so it returns successfully:

If I URL-encode '@' there too (as is done unfortunately in the real run environment) then can reproduce the same error:


2021-05-15 11-53-27
Adam Nagy

Also tried setting the input parameter to data type 'Email' just in case the '@' character might be treated in a different way - but it did not help

2021-01-19 14-07-32
Tom Zhao

Hi Adam,

Did you try it in postman or browser directly?

Kind regards,

2020-11-05 04-47-48
Nghia Hoang

Hi Adam,

I think you got the right path when encode URL the "@" character.
However, as the response message indicated, you can only use "@me" with 3 legged token.
That mean, the Token that use passed in the Authorization is not correct. You can refer further here : https://forge.autodesk.com/en/docs/oauth/v2/tutorials/get-3-legged-token

2021-05-15 11-53-27
Adam Nagy

Hi Nghia,

That's how I interpreted the message as well at first, but it's actually the other way round.
What it actually says is that when using a 3-legged token (and that is what I'm using) and not a 2-legged one (which might be used by internal services) you can only call that endpoint with '@me' as the user - and not '%40me'
You can try other user names as well (apart from '@me') and you'll get the same error message.

2021-05-15 11-53-27
Adam Nagy

Hi Tom,

Yes, it works in Postman as well:

As I showed in a previous reply, it even works in the "Test" tab of the REST call editor in outsystems Service Studio.

It just does not work in the real run environment as '@me' gets URL-encoded to '%40me' - you can see that from the error log in outsystems Service Center under Monitoring >> Integrations 

2025-03-25 14-32-34
Diogo Barata
Solution

Hi Adam,

I had the same problem.

You can use the OnBeforeRequest event of your REST API to manipulate your URL path. 

Use the DecodeURL action of the HttpUtility extension to remove all the Encoding and assign that value to the CustomizedRequest.URLPath.

2021-05-15 11-53-27
Adam Nagy

Thanks, Diogo!
Works great! :)

UserImage.jpg
RikVDN

For those who are searching for DecodeURL action. It is now in IntegrationsUtils

2020-08-06 11-01-55
Rob de Swart

It's now in HTMLUtils. They just keep changing it :)

UserImage.jpg
Igor Almeida
2020-08-06 11-01-55
Rob de Swart


Still in HTML Utils, it's a Forge component. 

https://www.outsystems.com/forge/component-overview/145/html-utils

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.