Pass the GET URL parameter to server action step via $GET.key

Guys,
I’ve read other posts on this topic yet could not figure it out.
My url has this GET.key: image
When I set the key variable in the Globals’ GET, the key has no value in the API when I filter a DB query.

Is it because the Form that runs the API on the page is a POST method?

Can you exlpain your setup a bit more?
Don’t understand what you mean by running API on page.

If you are calling a SA via server connect form with POST method, and the body contains this KEY… it will be available under $_POST.key.

Thanks for chipping in.
The GET.key url param is a uuid for registering behind a protected page. UUID is verified against those recorded in the database (DB). If they match, the registration page opens up.

That page has a standard form with input fields that are saved to our DB via API.


During form submission, we want to save the newly registered userID who used that uuid.
Right now we’re using the POST method with the key in hidden input field.
But I’d rather have that key on the server side from a $GET.key variable since the key is in the URL. But that $GET.key is empty, even when defined in Globals. Any clue why?

Can’t seem to get this method Filtering Database Query with an URL Parameter to work.

Looks like you have mosunderstood how get post work. Maybe read up a bit, i’ll stick to the solution.

For your use case here, the SA where you are verifying the UUID, save the uuid in a session variable there using set session.
Then, in the SA where you need to use it, just bind $_SESSION.keyuuid.

You can define the session in global input.

1 Like

Thanks for the session var idea.

I’ve read Filtering Database Query with an URL Parameter and understood the following:

  1. website.com?product_id=1234 where product_id is the GET url parameter.
  2. $_GET.product_id has a value of 1234 in the input in SA.
  3. Now can use that GET.product_id var for filtering a database query or update, like so:
    image

When I run my API, this key register?key=f3a584b7-c621-438a-cade-9947e4dc2517 has no value in the $_GET.key and therefore can’t filter my DB update. I don’t understand what’s wrong.

What you are missing/mis-reading in the tutorial is the way product_id is set.
Its being sent via SC parameter to the SA, where it then becomes available under $_GET.

On page, its available under query object, and not $_GET.

I did have a query.key set in the page for my SA where I’m verifying the UUID (query.key as input param of the server connect properties) and where $GET.key becomes available.
But I thought that same query.key var would be also available for the SA where I need to use it for filtering my DB update if the key var was set under the Globals’ $GET.

I’ll stick to this instead. Thanks for the coaching Siddhant!

Globals are just steps that get added to the top of all the SA at the time of execution.
They are evaluated just like any other step, every single time a SA is executed.

No problem. :slightly_smiling_face: