Pass URL ID to Server Connect and access it via an API Action

Hello Everyone,

I’ve been working on this issue all week now.
I have successfully created a page that pulls in the API data with the URL Parameter. Now I have a form on that same page that can then update the record in the API. I created a separate Server Connect with an API Action with a method of PATCH. Every time I run the server connect action it never pulls the URL Param from the page.

How can I get the URL Parameter in the Server Connect action?

It’s not entirely clear what you are doing. Can you show screenshots of the call settings on the frontend and in Server Action?

I believe I might be on to this.

I have a Server Connect Form that connects to a Server Connect. The SC has an API Action that Patch’s the current record. What I’m trying to access is the id of the record to use in the API URL.

image
Right now the Server Connect picks up the “supplierid”. I’m not sure if this should be used in _GET, _POST, _PARAM

Are you passing this id in the form? Are you using the POST method in the form?

Set to post. Then on your server side, create a post input with the name “supplierid”.
On the API select the post variable

This is where I get stuck.

The SC Form is a POST method:
image

After the Update button is Clicked, an action submits the form to the SC
image

All of the Form Fields are added under $_POST, while the supplierid value isn’t being sent over to the SC. When we run the form everything submits besides the supplierid value.
image

Can you show me what settings this supplierid field has?

And in SC in an external API call you use $_POST.supplierid something like this?

The supplierid field is a query parameter to the url of the record.
image

At the end of the day the “supplierid” field has to be in the url of the api query, but every time we run the query the “supplierid” field is being left out resulting in an error from the API

Did that, still doesn’t work. I believe the form is not sending over the “supplierid” value from the URL

Show your form and how it definitely has a field called supplierid

The form doesn’t have a field called “supplierid”, the “supplierid” field is from the url parameter setup in routing:
image

Add a hidden input field supplierid and bind its value to the query value dmx-bind:value=query.supplierid

add a field named supplierid to the form and assign it a dynamic value from the corresponding QueryManager parameter - have you added it to this page?

and it’s probably more correct to pass supplierid in the url not as part of the url, but as a parameter ?supplierid=12345 - it seems to me that it will be easier

This is how we want it done, seeing as the supplierid is not a field value but rather a record value.

I just tried the hidden field as described by @guptast and when we ran the form, although the supplierid shows in the network tab as being passed on, the SC doesn’t transmit the post value to the API, as the API is still showing as error
image
image

How would we be able to send the supplierid as a parameter and pull it in the SC?

Can you show the api and how do you send the value?

We’re using Appwrite for our Database API. What we’re trying to do is update the record

PATCH /databases/{databaseId}/collections/{collectionId}/documents/{documentId}

I’m trying to replace "{documentId}’ with supplierid


You can check the form values that are being sent to the API via the POST variables.

In the API, add a Set Value step, give it a name say PostVarCheck and add $_POST as its value in the dynamic picker. Enable its output. Disable all the subsequent API steps for this test.

In the front end when you submit the form, you will see the POST values in the Response tab for PostVarCheck. This way you can check whether all the expected values including supplierid are being sent to the API correctly or any of these is missing.

Show a screenshot of the settings for calling an external API in SC and how you form the url for calling this API