How is your experience with the OutSystems Community?
69
Views
10
Comments
Solved
consumed rest api is not supporting colon in the URI path
Application Type
Service

Hi, i am consuming a REST API for our app, the API i'm consuming has a parameter in the path, the parameter i'm sending is a UTXO id which has a colon at the end of it.

 `b8d7783b15c6e9594b3e0ef97ba9c68c18bdc3d5108745818a0a129dda6f714E:0`

it turns out like `b8d7783b15c6e9594b3e0ef97ba9c68c18bdc3d5108745818a0a129dda6f714E%3A0`

it's not like i can do anything about it, i need to consume it like this. isn't really a workaround for this?

2021-10-09 07-57-44
Stefan Weber
 
MVP
Solution

Hi, in the OnBeforeRequest handler after the default assignment add a Replace action to replace the encoded semi-colon.

Replace(CustomizedRequest.URLPath,"%3A",":")

UserImage.jpg
Alireza Farokhi

this did actually worked, thanks, the point is to do Replace(CustomizedRequest.URLPath,"%3A",":")

i was using wrong property of CustomizedRequest

2023-05-24 09-13-40
Thomas Anthony

it was working thanks

UserImage.jpg
vikas sharma
Champion
Solution

Hi

Can you try onBeforeRequest callback method. In this method try to replace the %3A with :

Not sure it will work or not but can give one try.

regards

UserImage.jpg
vikas sharma
Champion

Hi,

As you are passing this value in URL so its getting replace due to HTML URL encoding. But I guess it should work fine. What error you are getting exactly.

regards

UserImage.jpg
Alireza Farokhi

hi, thanks for the response, correct, it gets encoded. and thats the issue, the host expects to get the value as it is (with the colon) "4E:0" not "4E%3A0"

UserImage.jpg
vikas sharma
Champion
Solution

Hi

Can you try onBeforeRequest callback method. In this method try to replace the %3A with :

Not sure it will work or not but can give one try.

regards

UserImage.jpg
Alireza Farokhi

tried, no luck, probably encoding happens after that point

UserImage.jpg
vikas sharma
Champion


Hi Alireza,

I think then submitting the request manually can help here. 

Like we can use http methods from HTTPRequestHandler extension. Before calling the API append the value in URL manually using StringBuilder_append method in text. Then pass that string url directly to postSubmit method of httprequesthandler.

regards

UserImage.jpg
Alireza Farokhi
UserImage.jpg
vikas sharma
Champion

Yes, we should try this way if not getting any other better idea.

regards

2021-10-09 07-57-44
Stefan Weber
 
MVP
Solution

Hi, in the OnBeforeRequest handler after the default assignment add a Replace action to replace the encoded semi-colon.

Replace(CustomizedRequest.URLPath,"%3A",":")

UserImage.jpg
Alireza Farokhi

this did actually worked, thanks, the point is to do Replace(CustomizedRequest.URLPath,"%3A",":")

i was using wrong property of CustomizedRequest

2023-05-24 09-13-40
Thomas Anthony

it was working thanks

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