44
Views
2
Comments
I can't write brackets "{}" inside URL Path.
Application Type
Traditional Web

I have a table with several URLs for each record, and these URLs have the same base URL and return a JSON with another URL inside, as in the example:


  • Request:
  • http://****.com/public/****&cf=213&cv=3&mt=P&dados={'PARAMETER1':'24','PARAMETER2':'11','PARAMETER3':'223124', 'PARAMETER4':'12'}


  • Return:
  • {"data":"http://****d2s261a0e35d9&testMode=FALSE&language=pt_BR"}.


I used *** to hide some data.

I cannot access directly via the URL, as this would expose the data to users. So I'm doing it via API.

However, I am having a problem with my endpoint. The problem apparently lies in the use of brackets within this request. Outsystems doesn't seem to identify the brackets when I make the API call.


The only parameter I use is everything that comes after the "cf" parameter. (Used the function Subst() to get the content after "cf=213").


In the print, the test result don't identifies the "dados=" parameter. When i remove the brackets, the test result identifies, but don't works anyway.

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

{} are characters amongst the list of unsafe characters for an URL.

You need to encode them:

Here is the list of Unsafe characters:

[ ] { } | \ ” % ~ # < >

{ should be encoded as %7B

} should be encoded as %7D

For more information, see:

Regards,

Daniel

UserImage.jpg
RafaOda

Interesting, thanks for the return. It is now returning successfully the URL within the API test.


However, this API is still returning empty. I double-checked, and the parameter that the variable is taking before the request is identical to the one I used in the test.


So I believe the problem is in the API/Server Action structure.

just so you are aware, in the previous question, I had placed everything within the URL parameter, now I divided it into "URL" and "JSON data"


Could you help me, please?

The API is "GetLinkEtapaPublica" and the Server Action is GetLinkEtapaPublicaV2

Server Action:

Server Action Structure (URLEtapaPublica is a text variable)

API SettingsAPI Settings

Server Action Debug

Api Return Example (the link that i want)


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