# Making complex Types

**URL:** https://community.linx.software/community/t/making-complex-types/619
**Category:** How To
**Created:** [August 2, 2022, 3:29pm UTC](https://community.linx.software/community/t/making-complex-types/619 "2022-08-02T15:29:31Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Dawie\_Botes](https://community.linx.software/community/user_avatar/community.linx.software/dawie_botes/32/288_2.png) [@Dawie\_Botes](https://community.linx.software/community/u/Dawie_Botes)
#### Post date: [August 2, 2022, 3:29pm UTC](https://community.linx.software/community/t/making-complex-types/619/1 "2022-08-02T15:29:32Z")

</div>

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:

 ![Screenshot 2022-08-02 at 14.41.32](https://community.linx.software/community/uploads/default/original/2X/8/8e366bc3e5d7c53cf9d94707bc33cea01f1e2528.jpeg)

Then I’d create some of the Customer’s types like Address, Phone and Email:

 ![Screenshot 2022-08-02 at 14.43.08](https://community.linx.software/community/uploads/default/original/2X/6/67ce3089a324931176a070eeec956aa3800d9998.jpeg)

 ![Screenshot 2022-08-02 at 14.43.30](https://community.linx.software/community/uploads/default/original/2X/6/685870fa70fae1dac28ceeb76480606d66d09bcf.jpeg)

 ![Screenshot 2022-08-02 at 14.43.49](https://community.linx.software/community/uploads/default/original/2X/0/0680c7297c207e373b0cadfa84770dc2f7a799bf.png)

Now I can create my Customer Type:

 ![Screenshot 2022-08-02 at 14.47.07](https://community.linx.software/community/uploads/default/original/2X/3/3d70750f25e822ad3a39ac02600d99b8974ac061.jpeg)

Then finally I could construct my Order Type itself:

 ![Screenshot 2022-08-02 at 14.48.35](https://community.linx.software/community/uploads/default/original/2X/9/9bd99b6a1c44d1771650ddacb4b1e0e78514bc97.jpeg)

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):

 ![Screenshot 2022-08-02 at 14.50.27](https://community.linx.software/community/uploads/default/original/2X/4/489e743745b929eac6ef49db01f192eeed70d196.jpeg)

Now I’ve got a Type called Order which is quite complex:

 ![Screenshot 2022-08-02 at 17.27.44](https://community.linx.software/community/uploads/default/original/2X/5/5b387d9279998f0401d0c820ef21e74148bb163f.png)
