Guys,
I’ve read other posts on this topic yet could not figure it out.
My url has this GET.key:
When I set the key variable in the Globals’ GET, the key has no value in the API when I filter a DB query.
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?
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.
$_GET.product_id has a value of 1234 in the input in SA.
Now can use that GET.product_id var for filtering a database query or update, like so:
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.