This manual uses a simple data model as the basis for explaining how to use the REST API. Suppose we're tracking orders at a restaurant that delivers pizzas.
A customer may have placed any number of orders, and each order may contain any number of pizzas. The choice of pizzas however is from a menu which is the same for all customers.
This is expressed in the data model displayed in Illustration 1.
The depicted customer has placed three orders over time, the first two orders containing three different types of pizza, and the third order only one.
The ordered pizzas refer to a list that contains information on the pizzas themselves.
In the schematic these references are only displayed for the first order.
Each customer in the Deployteq CRM has a record with orders, but these all refer to the same list of pizzas. The design described above is expressed in the model displayed in Illustration 2.
Illustration 2: Data model of the pizza orders
The model has the following properties:
- The customer table is always defined, and has no columns, since the customer data are stored in the Deployteq CRM.
- A customer contains one or more orders. In this simple model an order has a delivery address, a text field for remarks, and a status flag indicating whether or not the order has been delivered.
- An order contains one or more ordered pizzas. An ordered pizza stores the type of pizza, the number of pizzas ordered for this type, and another text field for remarks.
- An ordered pizza looks up additional information on the pizza by means of the pizza column, which actually stores a reference to the pizza table.