Transaction Summary

Transaction Summary
lac31
As part of any POST, PUT or DELETE response, you can get a summary of the rules that were executed in the transaction.
In this article:
Display the Last POST/PUT/DELETE Rule Transaction Summary
You can view the last POST/PUT/DELETE rule transaction summary on the
TxSummary
tab in the REST Lab. The effects on related rows, and the logic execution flow are also shown. It is common that updates have computational side effects. This can be both on rows updated, or related data. For example, paying an order would reduce the customers' balance. Good UI design entails these results are shown to the End User. In many cases, this sadly requires a subsequent "fetch for refresh". This is inefficient, and in some cases not possible when the refreshed data has a system-generated primary key. API Creator therefore sends back the update response that contains all the updated rows. These are coerced into the types designated in the updating resource.
 You can see transaction summary arising from marking an order as paid in the REST Lab, showing the affected customer information, in the REST Lab. The following image shows the
Tx Summary
tab in the REST Lab:
rest lab tx summary tab.png
Obtain the Rules Summary
You can highlight the rule execution for a given PUT/POST or DELETE on the rule summary. The nested or indentation shows the levels of recursive firing of the rules. The following image shows the
Rule Summary
tab in the REST Lab:
rest lab rule summary tab.png
JSON
The following code snippet shows the JSON:
 
{
  "statusCode": 200,
  "txsummary": [
   {
      "@metadata": {
         "href": "http://localhost:8080/APICreator/rest/demo1/OneCustomer.Orders/1",
         "resource": "OneCustomer.Orders",
         "verb": "UPDATE",
         "checksum": "767423ee17fdc97a6daf5f80f4481a20"
       },
       "order_number": 1,
       "amount_total": 35,
       "paid": false,
       "notes": "This is a small order",
       "customer_name": "Alpha and Sons"
    },
    {
       "@metadata": {
          "href": "http://localhost:8080/APICreator/rest/demo1/OneCustomer/Alpha and Sons",
          "resource": "OneCustomer",
          "verb": "UPDATE",
          "checksum": "1af862cf2b102a7c1c8ed540183b46a2"
        },
        "name": "Alpha and Sons",
        "balance": 155,
        "credit_limit": 900
    }
  ],
  "rulesummary": [
    {
      "type": "LOGIC_RUNNER",
      "entity": "purchaseorder",
      "pk": "purchaseorder[{order_number=1}]",
      "subtype": "BEGINUPDATE"
    },
    {
      "type": "BEFORE_ACTION",
      "entity": "purchaseorder",
      "pk": "purchaseorder[{order_number=1}]"
    },
    {
      "type": "AFTER_ACTION",
      "entity": "purchaseorder",
      "pk": "purchaseorder[{order_number=1}]"
    },
    {
      "type": "AFTER_AGGREGATE",
      "entity": "customer",
      "pk": "customer[{name=Alpha and Sons}]",
      "OldValue": 120
    },
    {
      "type": "LOGIC_RUNNER",
      "entity": "customer",
      "pk": "customer[{name=Alpha and Sons}]",
      "subtype": "BEGINUPDATE"
    },
    {
      "type": "AFTER_CONSTRAINT",
      "entity": "customer",
      "pk": "customer[{name=Alpha and Sons}]"
    },
    {
      "type": "LOGIC_RUNNER",
      "entity": "customer",
      "pk": "customer[{name=Alpha and Sons}]",
      "subtype": "END"
    },
    {
      "type": "LOGIC_RUNNER",
      "entity": "purchaseorder",
      "pk": "purchaseorder[{order_number=1}]",
      "subtype": "END"
    },
    {
      "type": "BEFORE_COMMIT"
    },
    {
      "type": "AFTER_COMMIT"
    }
  ]
}