POST/PUT/DELETE/PATCH Response
------------------------------

Support for synchronous and asynchronous request resulting in transactions, is controlled by the ``nowait`` parameter in the request URL.  
The support for asynchronous request handling is indicated in the API schema structure **actions** with the ``support_async`` property.


The outline of the default synchronous transaction response of mutator transactions 
when the API parameter ``nowait`` is set to be false, is as follows:

::
    
    {
      "pkid": "51f7e09bd0278d4b28e981da",
      "model_type": "data/CallManager",
      "meta": {
        "parent_id": {
          "pkid": "51f7d06ad0278d4b34e98134",
          "uri": "/api/data/HierarchyNode/51f7d06ad0278d4b34e98134"
        },
        "summary_attrs": [
          {
            "name": "description",
            "title": "Description"
          },
          {
            "name": "host",
            "title": "Host Name"
          },
          {
            "name": "port",
            "title": "Port"
          }
        ],
        "uri": "/api/data/CallManager/51f7e09bd0278d4b28e981da"
      },
      "success": true
    }

The outline of the synchronous response to asynchronous mutator transactions 
when the API parameter ``nowait`` is set to be true, is as follows:

::

   {
     "href": "/api/tool/Transaction/cfe8a8fd-98e6-4290-b0c3-2dfa2224b808", 
     "success": true, 
     "transaction_id": "cfe8a8fd-98e6-4290-b0c3-2dfa2224b808"
   }



To retrieve (for example by polling) the transaction status of any mutator transactions,
use the *transaction_id*  in the synchronous response to the asynchronous mutator transaction 
as follows:

::

   GET /api/tool/Transaction/cfe8a8fd-98e6-4290-b0c3-2dfa2224b808

The response contains the status ad replay action URL, for example:


::

   {
    "meta": {
           "model_type": "tool/Transaction",
           "summary_attrs":
           {
            "name": "name",
            "title": "Name"
           },
           "references": {}
           "actions":
             {
              "replay": {
                "class": "execute",
                "href": "/api/tool/Transaction/cfe8a8fd-98e6-4290-b0c3-2dfa2224b808/
                  replay?format=json",
                "method": "GET",
                "title": "Replay"
               }
             } 
           }
    "data": {
          "status": "Completed",
          "username": "sysadmin",
          "resource": {
           "hierarchy: "sys",
           "after_transaction": "/api/data/GeneralHelp/5268c7d3a616540a766b91f5/?
             cached=5268f2eba616540a736b926c Entity",
           "current_state": "/api/data/GeneralHelp/5268c7d3a616540a766b91f5/ Entity",
           "before_transaction": "/api/data/GeneralHelp/5268c7d3a616540a766b91f5/
             ?cached=5268c7d3a616540a766b91f7 Entity",
           "pkid": "5268c7d3a616540a766b91f5",
           "model_type": "data/GeneralHelp",
          }
     [...]


This mechanism can be used to retrieve the transaction status of any transaction or its sub-transaction,
using the pkid of the (sub) transaction.

For the View model, the GET call to ``tool/Transaction/[trans pkid]``
shows the View resource has no instance pkid, because a view model 
stores no instances.

.. |VOSS-4-UC| replace:: VOSS-4-UC
.. |Unified CM| replace:: Unified CM