SampleAPI illustrates advanced rules and database concepts. It consists of an order entry, departments database of few dozen tables, with complex logic and relationships. This API includes the Sample database.
This API is included with the single-user demonstration package of
CA Live API Creatorthat is based on Jetty and with the
CA Live API CreatorDocker container installation. No additional steps are required to load this API.
You can also load this API sample if you have installed
CA Live API Creatoron another container.
The following image shows the schema:
product_billofmaterialstable represents that:
- A "kit" product may have many "component" products. For example, a wing can consist of engines and bolts.
- A "component" product may be a component of many kits. For example, bolts are used in wings and engines.
A product, such as a wing, can be a component (of a plane) and a kit.
The Sample database contains the
productstable, as illustrated in the following image:
Consider the following example:
- A Boing 747 consists of a Fuselage, Wing, and Bolts
- A Wing consists of an Engine and Bolts
That is represented by rows in the
product_billofmaterialstable, as illustrated in the following image:
Products are entered into the same products table but are differentiated, as follows:
- Kit: A product with components. For example, Boing, Wing.
- Component: A product that is a component. For example, Fuselage, Bolt, Wing, Engine.
Wing is a kit and a component, a recursive relationship.
The following relationships are from product to
- TheinKits: productrelationshipTheproduct_nameforeign key implements theinKits: productrelationship. This relationship is from product toproduct_billofmaterials.product.inKitsreturns theproduct_billofmaterialsidentifying the kits in which a product is a member.Thebolt.inKitsrelationship returns( (Boing, Bolt) and (Wing, Bolt) ). Theproduct_billofMaterials.productrelationship returns the component,(Boing, Bolt)returnsBolt.
- Thecomponents: kitrelationshipTheproduct_name_kitforeign key implements thecomponents: kitrelationship.product.componentsreturns theproduct_billofmaterialsidentifying the components in this kit. So,boing.componentsreturns( (Boing, Bolt) (Boing, Fuselage) (Boing, Wing) ).ProductBillofmaterials.kitreturns the kit. So,(Boing, Bolt)returnsBoing.
A Boing price calculates to $10,300:
Ordering a Boing 747 effects Product qtyOnHand, as follows:
- 1 Fuselage @ $1300 = $1,300
- 100 Bolts @ $10 = $1,000
- 2 Wings @ $4,000 = $8,000, which itself is calculated as...
- 2 Engines @ $1,500 = $3,000
- 100 Bolts @ $10 = $1,000
- totalQtyOrdered[Engines] increased by 4 (2 for each of 2 wings).
- totalQtyOrdered[Bolts] increased by 300 (100 from Boing, 100 for each of 2 wings).
Ordering the Boing 747 inserts the following LineItems:
- Boing 747