It’s quite easy to create “nested” or “complex” Types which you can use as your Request or Response for your SimpleREST Hosts.
The key is to create a Type, and add it to another type…
For instance, let’s say I’ve got a Type called “Order”. An order can contain data like, OrderNumber, OrderDate, TotalAmount etc. But then, it can also contain a Customer. A Customer itself can contain a CustomerName, Surname, Code and also Addresses and Phone numbers and Emails. Each of these can then contain their own data, for instance, Address can contain an Address type, Street name, suburb, city, country. etc etc. Then our Order again can contain OrderLines, which each can contain LineNumber, Description, quantity, sub-total etc.
So you can see it can become really complex.
Now let’s say you want to create this “Order” type from scratch. First thing is, create each of the deepest types. For example, start with the “OrderLine” type:
Then I’d create some of the Customer’s types like Address, Phone and Email:
Now I can create my Customer Type:
Then finally I could construct my Order Type itself:
Now… One can rightfully argue that normally, an Order could have more than 1 OrderLine. So, I would change the Order to have a List of Orderlines, and not just a single OrderLine, so I change the type (this is all done with the dropdown):
Now I’ve got a Type called Order which is quite complex: