TMS Web Core (v2.5) & Radserver & Delphi (v 12) Resource Naming Convention

I have a strange nuance that I hope you can help me resolve. I notice your demo formats resources like:
RadServer1.RadServerURL := 'http://localhost:8080';
RadServer1.TableName := 'data/vendors';
RadServer1.KeyFieldName := 'Vendor_ID';
// define fields
RadServer1.FieldDefs.Clear;
RadServer1.FieldDefs.Add('Vendor_ID', ftInteger);
RadServer1.FieldDefs.Add('Name', ftstring);

But that never works for us. Our middleware (RadServer) resource is defined like:
[ResourceName('data')]
TTestResource1 = class(TDataModule)
FDConnection1: TFDConnection;
qryVendors: TFDQuery;
[ResourceSuffix('vendors')]

What works for us for GETs is:
RadServer1.RadServerURL := 'http://localhost:8080';
RadServer1.TableName := 'data/vendors/';
RadServer1.KeyFieldName := 'Vendor_ID';
// define fieds
RadServer1.FieldDefs.Clear;
RadServer1.FieldDefs.Add('Vendor_ID', ftInteger);
RadServer1.FieldDefs.Add('Name', ftstring);

Notices we had to add the "/" at the end of the resource name to get the TWebRadServerClientDataSet to properly GET records.... for GETs, adding the "/" allows it to work perfectly. However, if we POST records the records save, BUT apparently the TWebRadServerClientDataSet does a follow PUT that always results in errors it seems because of the auto-PUTs controlled by the TWebRadServerClientDataSet component. We drew this conclusion because this behavior does NOT occur when we POST records via RadServer Debugger, nor with Postman.

After each POST via the TWebRadServerClientDataSet RadServer indicates correctly that a record was posted, but it also indiactes a PUT request followed. Our current application does NOT using any PUT statement. Only POSTs and GETs.

{"Thread":27312,"Time":"12/6/2025 3:25:18 PM","Request":{"Resource":"data","Endpoint":"dsrVendors.Post","Method":"POST","User":"(blank)","IP":"0:0:0:0:0:0:0:1"}}
{"Thread":24500,"Time":"12/6/2025 3:25:19 PM","Error":{"Type":"HTTP","Code":"404","Reason":"Error","Error":"Not found","Description":"Resource not found: PUT /data/vendors//37","IP":"0:0:0:0:0:0:0:1"}}
{"Thread":15804,"Time":"12/6/2025 3:25:19 PM","Error":{

Notice the follow-up PUT is formatted /data/vendors//37 with "//" which is certainly where the error originates.

We want to resolve these errors but cannot locate a setting to prevent the unwanted PUTs or ensure the component is not adding the extra "/". We could not find a configuration in RADServer to strip the extra "/" nor in The TwebRadServerClientDataSet component. As we indicated, all records are retrieved correctly without error, but POSTing allows saving records but noisey error that we don't want. HELP please.

For a POST, the URL is composed via:

URL := FDataProxy.Db.ApiBase + '/' + FDataProxy.TableName;

For a PUT, the URL is composed via:

URL := FDataProxy.Db.ApiBase + '/' + FDataProxy.TableName + '/' + String(FData[FDataProxy.KeyFieldName]);

Do you mean your POST is not working when

RadServer1.TableName := 'data/vendors';

and why not?

That is correct, the post, GET and other commands do not work unless the tablename in code ends with the "/". That is even in the case with Radserver Debugger and browser the slash needed to return data even if the resource was not defined that way. I cannot answer why... hoping your team could...
Using Azure SQL on the backend. Just upgraded to Delphi 13 and the latest TMS Web Core to see if that changes anything... it did not.

We applied an improvement that when the URL has already a backslash, it will be taken in account to avoid double backslashes when the path gets extended from the component.
This improvement will be in the next update.

1 Like