Format for RESTRequest to consume EchoString POST

In the EchoString Example in XData:
[httpPOST] function EchoString(Value: string): string;

How do I configure the RESTRequest to send "Value" as this doesn't seem to do it:
RESTRequest1.Resource := 'EchoString';
RESTRequest1.Method := TRESTRequestMethod.rmPOST;
RESTRequest1.AddParameter('Value', 'This is text');

By default parameters in POST requests should be sent in JSON, according to documentation:
https://download.tmssoftware.com/business/xdata/doc/web/parameter-binding.html

You must also provide the full URL according to the proper routing mechanisms:
https://download.tmssoftware.com/business/xdata/doc/web/routing.html

Any reason why you are using RESTRequest when you can use TXDataClient which does all that job for you?

1 Like

I am using the RESTRequest as I am converting applications that already existed. I am also trying to not change the format of the existing calls as they were setup based on models I was familiar with like credit card processing and SMS interfaces based on their RESTful API. Therefore I was really looking to make the changes on the server side rather than the client.

Yes, you can modify the server using Route attributes and parameter binding attributes to publish your service operation the way you want, as explained in the links I mentioned.
I don't know how your URL and parameter should be.