• Resolved kimineko

    (@kimineko)


    Hi there,

    how would I go about to use multiple parameters passed from an URL. In my case I would have an URL like this:

    https://website?id=firstparameter?ac=secondparameter

    According to the documentation request.query should contain all queries. However, I am unable to access each parameter individually, as the object contains the query as a string. So it always outputs firstparameter?/ac=secondparameter.

    Do I need another delimiter or what would be the correct schema for the url and the twig?

    Best
    Kim

    • This topic was modified 1 year, 8 months ago by kimineko.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author alexacrm

    (@alexacrm)

    Hi Kim,

    you can access parameters using request.params collection. See https://docs.alexacrm.com/integration-cds/twig/#get-current-request-information for more details. In your case it’d be request.params["id"] and request.params["ac"]

    Hope it helps
    AlexaCRM

    Thread Starter kimineko

    (@kimineko)

    Hi,

    [icds_twig]
    {{ request.params["id"] }}
    {{ request.params["ac"] }}
    [/icds_twig]

    used with the following URL:
    https://mywebsite.com/institut/kontakt/confirm?id=testid?ac=testac

    returns
    testid?ac=testac for id and nothing for ac.

    It seems like the second ? is for some reason converted to “%3Fac%3D” – see the results of the following:

    [icds_twig]
    <table>
    <tr><td style="wdith: 300px;">params</td><td style="overflow-wrap: anywhere;">{{ request.params |join }}</td></tr>
    <tr><td>params id</td><td>{{ request.params["id"] }}</td></tr>
    <tr><td>params ac</td><td>{{ request.params["ac"] }}</td></tr>
    <tr><td>path</td><td>{{ request.path }}</td></tr>
    <tr><td>path_and_query</td><td>"{{ request.path_and_query }}</td></tr>
    <tr><td>query</td><td>{{ request.query }}</td></tr>
    <tr><td>url</td><td>{{ request.url }}</td></tr>
    </table>
    [/icds_twig]

    returns

    
    params	{stamp:\'2yCBUwSIBd3Q4BK/vJyH1VYL2u/jFvkOMYdb9okBae9xm8RPAUIYDA==\',necessary:true,preferences:true,statistics:true,marketing:true,
    method:\'explicit\',ver:1,utc:1673555372631,region:\'de\'}44583ad0-beaa-4756-86e3-d51ae384bf41000cb5GA1.2.980823569.1678692787libraryContent=browse&ampampampeditor=html&ampampampeditor_expand=off&ampampampunfold=1&ampampampmfold=
    o&ampampampimgsize=thumbnail&ampampamped_size=487&ampampampposts_list_mode=excerpt&ampampamphidetb=0&imgsize=&mfold=o&unfold=1&posts_list_mode
    =excerpt&editor_expand=off&editor=html16786982561WP Cookie checki6003931|1679037413|MhnnJDZ9buVk4eY5ImpjmL5ThXeHkzbCTQWzlD4aaFI|99abaae5450195889f8a6dc86woo:QMoEVaoE0tPSImCI8yLL1GHe16486a82547087016eeecdce31a53e3991||1679037430||1679033830||e766579b11678867259.0.0.0testid?ac=testac
    params id	testid?ac=testac
    params ac	
    path	/institut/kontakt/confirm
    path_and_query	"/institut/kontakt/confirm?id=testid?ac=testac
    query	?id=testid%3Fac%3Dtestac
    url	https://mywebsite.com/institut/kontakt/confirm?id=testid%3Fac%3Dtestac
    • This reply was modified 1 year, 8 months ago by kimineko.
    • This reply was modified 1 year, 8 months ago by kimineko.
    Plugin Author alexacrm

    (@alexacrm)

    @kimineko your url is not constructed correctly. Parameters must be separated by & not by ?. Your url should be

    https://mywebsite.com/institut/kontakt/confirm?id=testid&ac=testac

    Thanks

    Thread Starter kimineko

    (@kimineko)

    A very simple solution ?? thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘URL Multiple Query Parameters’ is closed to new replies.