TMS XData/Aurelius Api Call with 2 tables

Hi i'm using TMS XData with TMS Aurelius.

I want to allow a customer to do an API Call to create a new order with both the order and the itemlines in it. (Orders and Orderlines are separate tables)
I can do that in separate API Calls, but i only want to allow the order if both the order fields are all filled and the products on the itemlines should also exist.

The order contains an order reference, and delivery address, the itemlines contain the product SKU and the quantity.

I would like to do a call like this example.
"id": "12345-234",
"deliveryaddress": {
"company": "Niko",
"recipient": "Jan de Besteller",
"street": "straatnaam",
"number": "12",
"nummeraddition": "a",
"zipcode": "12345",
"city": "Paris",
"countrycode": "FR"
"orderlines": [
"sku": "123456",
"count": 100
"sku": "7654321",
"count": 900

Any help how i can accomplish this would be nice.

Regards, Erik

Hi @van_Putten_Dirk_Erik, welcome to TMS Support Center!

Simply create a Delphi class representing the JSON you want to receive, then create a service operation receiving an instance of such class as a parameter.

Thank you Wagner, i now get the general idea. However the manual is very concise. Is there any chance for a small example, or can you redirect me to a manual or video that discribes or shows this ?

In which sense the manual is very concise? It fully describes how to create service operations with all steps.

Have you also checked the XData demos? There are several examples that use service operations.

I'm sorry, i went through all the examples, but i can't find anything about master-detail posting of records through the Rest API. I have made a working Service with all my tables and can view, modify, post, delete all records for each table, but not multi-table. I need a REST call that posts the equivalent of 1 album with multiple tracks in one go if you refer to the music database example. In my case the tracks can only be posted if the genre exists (3rd table), if not send a message and abort the complete post. Would be a nice example for anybody i guess.

Create your Delphi class as usual, with the information you want to receive (source code simplified, you can extend it, like property declarations and list creation):

TOrderDocument = class
  property Id;
  property DeliveredAddress: Address;
  property OrderLines: TList<TOrderLine>;

Declare address and order line classes accordingly. Then just declare your service contract method like this:

procedure PlaceOrder(Order: TOrderDocument);

Then in implementation, check your Order object if it's ok. If not ok, just raise exceptions to inform the user of the problems.
You can raise exceptions of type EXDataHttpException to return status code of 400.

That's pretty much it as a concept.