0

I have got requirements like below:

enter image description here

 /paymenturl?ordernr=123&amount=234&ourOwnCallbackUrl=$api/receipt?contractid=3232&callbackurl=https://somthing.com&fallbackurl=https:something.com&notification=hit-hard
  1. Is it possible to add url in query parameter? (callbackUrl)
  2. Is it possible to add Step 1 into value of Query Parameter? (ourOwnCallbackUrl)
  3. Is it possible to add Step1 in Step 2 to main url? (/paymenturl)

The question is basically how to add another URL to query parameter and can it be nested further?

Community
  • 1
  • 1
fatherazrael
  • 5,511
  • 16
  • 71
  • 155
  • you can endcode it in Base64 – mhrsalehi Jun 05 '20 at 17:09
  • @mhrsalehi: Is it not possible without encoding as we need to redirect it to this url? Encoding also lead to front end do some decoding and fetch url and forward. Will it be problem if done directly. – fatherazrael Jun 05 '20 at 17:11

1 Answers1

0

you have to escape the special characters (like &) I see two common ways:

  • encode it in percent-encoded

    %20%2Fpaymenturl%3Fordernr%3D123%26amount%3D234%26ourOwnCallbackUrl%3D%24api%2Freceipt%3Fcontractid%3D3232%26callbackurl%3Dhttps%3A%2F%2Fsomthing.com%26fallbackurl%3Dhttps%3Asomething.com%26notification%3Dhit-hard

  • or you can create a complete DTO (Data transfer object ) and use the request body to send/receive it from your controller.

mhrsalehi
  • 1,124
  • 1
  • 12
  • 29
  • In my experience this is normally termed 'url-encoded'. I found a discussion on this topic at: https://stackoverflow.com/questions/2678551/when-to-encode-space-to-plus-or-20 – Bill Naylor Jun 05 '20 at 18:11