Create a Private Response MDC

In this task, you create a custom MATRIXX Data Container (MDC) to hold the information that comprises the REST response. This custom offer purchase response for a subscriber defines the information needed to find the subscriber and to select an offer. All REST requests are derived from the out-of-the-box MtxRequest object.

Before you begin

This task assumes that you are already editing the projects/purchase/src/main/resources/extension-rest-mdc.xml file.

Procedure

Define the private response MDC with three fields (PrePurchase, Purchase, and PostPurchase).

Remember, you must define all MDC definitions and REST calls within the <configuration> … </configuration> nodes. Add the following code.

<container id="DemoResponseSubscriberPurchase">
    <doc_description>Demonstration of a custom offer purchase</doc_description>
    <created_schema_version>2</created_schema_version>
    <base_container id="2">MtxResponse</base_container>
    <field id="PrePurchase">
        <created_schema_version>2</created_schema_version>
        <doc_description>Subscriber before the purchase</doc_description>
        <datatype>struct</datatype>
        <struct_id>SubscriberResponse</struct_id>
    </field>
    <field id="Purchase">
        <created_schema_version>2</created_schema_version>
        <doc_description>Response from the offer purchase</doc_description>
        <doc_required/>
        <datatype>struct</datatype>
        <struct_id>MtxResponsePurchase</struct_id>
    </field>
    <field id="PostPurchase">
        <created_schema_version>2</created_schema_version>
        <doc_description>Subscriber after the purchase</doc_description>
        <datatype>struct</datatype>
        <struct_id>SubscriberResponse</struct_id>
    </field>
    <storage_size>large</storage_size>
</container>

What to do next

Define the request and response MDC relationship.