How to get URL paramater and use it is as request parameter for an API?

Hi All,

I have URL's as follows,

https://www.xyz.com/Test/?abc=44123456789

https://www.xyz.com/Test/?token=f1dc5fe957a8b8ae0dd68077725d18b3

In this, I want to take the value of abc (i.e.44123456789) and pass it as  input parameter as "identifier"to the API. Similarly, I want to use the value of token  (i.e.f1dc5fe957a8b8ae0dd68077725d18b3) and pass it as  input parameter as "sessionId" to the API.

Could you please help me with this?


Thanks,

Hema

Solution

You can use string substr(), just start from the end and go until the "="

Look at the OML

This is the function you can use to retrieve the value after the =

Substr(value,Index(value,"=",Length(value),searchFromEnd:True)+1,Length(value))


SplitSubstr.oml

Hi Hemalatha,

Use a Javascript function to get the URL and it will also parse the querystring key value . Please find below link and attached demo,

Javascript client action takes querystring name as input and returns value of that



https://dbaghel.outsystemscloud.com/TestJob/Screen1?Name=333333

Enter the querystring name in Input Text box in above screen you will get the value.

Best Regards

Devendra


TestJob.oml

Solution

You can use string substr(), just start from the end and go until the "="

Look at the OML

This is the function you can use to retrieve the value after the =

Substr(value,Index(value,"=",Length(value),searchFromEnd:True)+1,Length(value))


SplitSubstr.oml

Hi Marc,

It is working as expected.

My doubt is that you have stored the URL as "value". But in my application, I won't be storing the URL anywhere. How can I make the same scenario possible in my application?

Thanks,

Hema

Hi Hemalatha,

Use a Javascript function to get the URL and it will also parse the querystring key value . Please find below link and attached demo,

Javascript client action takes querystring name as input and returns value of that



https://dbaghel.outsystemscloud.com/TestJob/Screen1?Name=333333

Enter the querystring name in Input Text box in above screen you will get the value.

Best Regards

Devendra


TestJob.oml

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