350
Views
10
Comments
Solved
Parsing URL query params from an exposed API
Question

hey,

i'm trying to parse the request i'm getting to an exposed API i've configured as POST method, the POST call to this endpoint contains a parameters as part of it's URL, for example my API endpoint in outSystems: <URL>/rest/v1/payments?signature=dsf54sd5f4ds56f4.

i've already configured an input parameter in my method and set it's "Receive In" attribute to - " URL" and the attribute "Name in Request" as the name of the param in the API endpoint - "signature".

but i'm keep getting no data in the input parameter.

can somebody assist?


thanks!


2021-06-09 13-39-18
Agno Silveira
 
MVP
Solution


the ideal is that you have several input parameters:


but yes, you can receive a parameter only in your URL (maybe a JSON), containing several information, but I don't indicate it because there may be loss of information when manipulating the text.


In cases of various information you can also receive your entry in the body:

2021-06-09 13-39-18
Agno Silveira
 
MVP

Hello Eli,

I created a scenario similar to yours and tested it by POSTMAN, it worked correctly.

Can you share more details of your end point (images, .oml)? 

how are you testing?


images of my scenario and test:


Documentation:


Regards.

UserImage.jpg
Eli Zilbershmidt

thanks it worked via POSTMAN and with the debugger (didn't know i can debug backend processes) , but, what if i have several params in the URL, for example: <URL>/rest/v1/payments?signature=dsf54sd5f4ds56f4&user=12345, what then do i need to input in the "Name in the request" property in the Input parameter?

thanks!


2021-06-09 13-39-18
Agno Silveira
 
MVP

Right,

This property "Name in the request" is actually more used when you receive a parameter by header, in our case we receive it by URL if we leave it blank it will work normally (image), but you can leave the "name in request", it's nice.

Regards.

UserImage.jpg
Eli Zilbershmidt

when leaving it empty - it's assigning all other fields the same value:

i assume it's because the input param isn't parsed.

i've created an output param in the API method to check the values so i can also see them in POSTMAN in the response.


is there any solution for parsing it upon incoming POST call?


2021-06-09 13-39-18
Agno Silveira
 
MVP

Can you share your .oml please? (or image of how you are returning values to POSTMAN)

for me to check how you are returning the values to postman.

UserImage.jpg
Eli Zilbershmidt

sure.

I want to be able to parse the incoming input (from the URL params) and assign my variable with the params from the URL.


the API method:


the variable assignment:


2021-06-09 13-39-18
Agno Silveira
 
MVP

right,

there is the problem because it is returning to POSTMAN the same value for the two variables, you are assigning the same value to both.

for shipping_charges you must return the value of  shipping_charges and not signature.

:)


UserImage.jpg
Eli Zilbershmidt

i understand, but i have only one input param (please ignore it's name :)) that i want to contain my entire URL params and i would be able to parse it to my response structure.


it there a way to achieve it? or i need several input params for each query param in the URL?

2021-06-09 13-39-18
Agno Silveira
 
MVP
Solution


the ideal is that you have several input parameters:


but yes, you can receive a parameter only in your URL (maybe a JSON), containing several information, but I don't indicate it because there may be loss of information when manipulating the text.


In cases of various information you can also receive your entry in the body:

UserImage.jpg
Eli Zilbershmidt

thanks for your help!!

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