# Retrieve Contract Tree Structure Summary source: https://developer.mastercard.com/mastercard-processing-core/documentation/sandbox-testing/data-management/query-cms-to-get-particular-data/retrieve-con-tree-struct-sum/index.md ## Test case -- Success -- Tree structure for a top Account Contract {#test-case--success--tree-structure-for-a-top-account-contract} This test case describes retrieving a tree structure stored in the CMS for the top account contract. Note: For the `/contracts/{contract_id}/tree-summaries` endpoint, the Sandbox stores the contracts tree structure containing 15 records: * 1 top account contract * 10 subaccounts * 4 card contracts For this test case, use the following information in the request:
| Path parameter | Available value | |----------------|-----------------| | `contract_id` | 70001 | **Sample request** `GET /contracts/70001/tree-summaries?limit=15&offset=0` **Sample response** `200` ```JSON { "count": 15, "limit": 15, "offset": 0, "total": 15, "contractSummaries": [ { "contractCategory": "Account", "contractId": 70001, "contractLevel": ".", "contractName": "Account contract name 1", "contractNumber": "915555______0017", "leaf": "N" }, { "contractCategory": "Account", "contractId": 70002, "contractLevel": ".1.", "contractName": "Account contract name 2", "contractNumber": "915555______0018", "leaf": "Y", "liabilityCategory": "N", "liabilityContractId": 70001, "liabilityContractNumber": "915555______0017" }, { "contractCategory": "Account", "contractId": 70003, "contractLevel": ".2.", "contractName": "Account contract name 3", "contractNumber": "915555______0019", "leaf": "N", "liabilityCategory": "N", "liabilityContractId": 70001, "liabilityContractNumber": "915555______0017" }, { "contractCategory": "Card", "contractId": 70004, "contractLevel": ".2.1.", "contractName": "Card contract name 1", "contractNumber": "524404______3173", "leaf": "Y", "liabilityCategory": "N", "liabilityContractId": 70003, "liabilityContractNumber": "915555______0019" }, { "contractCategory": "Card", "contractId": 70005, "contractLevel": ".2.2.", "contractName": "Card contract name 2", "contractNumber": "524404______8862", "leaf": "Y", "liabilityCategory": "N", "liabilityContractId": 70003, "liabilityContractNumber": "915555______0019" }, { "contractCategory": "Account", "contractId": 70006, "contractLevel": ".3.", "contractName": "Account contract name 4", "contractNumber": "915555______0020", "leaf": "N", "liabilityCategory": "N", "liabilityContractId": 70001, "liabilityContractNumber": "915555______0017" }, { "contractCategory": "Account", "contractId": 70007, "contractLevel": ".4.", "contractName": "Account contract name 5", "contractNumber": "915555______0021", "leaf": "Y", "liabilityCategory": "N", "liabilityContractId": 70001, "liabilityContractNumber": "915555______0017" }, { "contractCategory": "Account", "contractId": 70008, "contractLevel": ".5.", "contractName": "Account contract name 6", "contractNumber": "915555______0022", "leaf": "N", "liabilityCategory": "N", "liabilityContractId": 70001, "liabilityContractNumber": "915555______0017" }, { "contractCategory": "Account", "contractId": 70009, "contractLevel": ".6.", "contractName": "Account contract name 7", "contractNumber": "915555______0023", "leaf": "Y", "liabilityCategory": "N", "liabilityContractId": 70001, "liabilityContractNumber": "915555______0017" }, { "contractCategory": "Account", "contractId": 70010, "contractLevel": ".7.", "contractName": "Account contract name 8", "contractNumber": "915555______0024", "leaf": "N", "liabilityCategory": "N", "liabilityContractId": 70001, "liabilityContractNumber": "915555______0017" }, { "contractCategory": "Card", "contractId": 70011, "contractLevel": ".7.1.", "contractName": "Card contract name 3", "contractNumber": "524404______3174", "leaf": "Y", "liabilityCategory": "N", "liabilityContractId": 70010, "liabilityContractNumber": "915555______0024" }, { "contractCategory": "Card", "contractId": 70012, "contractLevel": ".7.2.", "contractName": "Card contract name 4", "contractNumber": "524404______8863", "leaf": "Y", "liabilityCategory": "N", "liabilityContractId": 70010, "liabilityContractNumber": "915555______0024" }, { "contractCategory": "Account", "contractId": 70013, "contractLevel": ".8.", "contractName": "Account contract name 9", "contractNumber": "915555______0025", "leaf": "N", "liabilityCategory": "N", "liabilityContractId": 70001, "liabilityContractNumber": "915555______0017" }, { "contractCategory": "Account", "contractId": 70014, "contractLevel": ".9.", "contractName": "Account contract name 10", "contractNumber": "915555______0026", "leaf": "Y", "liabilityCategory": "N", "liabilityContractId": 70001, "liabilityContractNumber": "915555______0017" }, { "contractCategory": "Account", "contractId": 70015, "contractLevel": ".10.", "contractName": "Account contract name 11", "contractNumber": "915555______0027", "leaf": "Y", "liabilityCategory": "N", "liabilityContractId": 70001, "liabilityContractNumber": "915555______0017" } ] } ``` ## Test case -- Success -- Tree structure for a Subaccount {#test-case--success--tree-structure-for-a-subaccount} This test case describes retrieving a tree structure stored in the CMS for a specified subaccount. Note: For the `/contracts/{contract_id}/tree-summaries` endpoint, the Sandbox stores the contracts tree structure containing 15 records: * 1 top account contract * 10 subaccounts * 4 card contracts For this test case, use the following information in the request:
| Path parameter | Available value | |----------------|-----------------| | `contract_id` | 70002 | | | 70003 | | | 70006 | | | 70007 | | | 70008 | | | 70009 | | | 70010 | | | 70013 | | | 70014 | | | 70015 | **Sample request** `GET /contracts/70003/tree-summaries?limit=15&offset=0` **Sample response** `200` ```JSON { "count": 4, "limit": 15, "offset": 0, "total": 4, "contractSummaries": [ { "contractCategory": "Account", "contractId": 70001, "contractLevel": ".", "contractName": "Account contract name 1", "contractNumber": "915555______0017", "leaf": "N" }, { "contractCategory": "Account", "contractId": 70003, "contractLevel": ".2.", "contractName": "Account contract name 3", "contractNumber": "915555______0019", "leaf": "N", "liabilityCategory": "N", "liabilityContractId": 70001, "liabilityContractNumber": "915555______0017" }, { "contractCategory": "Card", "contractId": 70004, "contractLevel": ".2.1.", "contractName": "Card contract name 1", "contractNumber": "524404______3173", "leaf": "Y", "liabilityCategory": "N", "liabilityContractId": 70003, "liabilityContractNumber": "915555______0019" }, { "contractCategory": "Card", "contractId": 70005, "contractLevel": ".2.2.", "contractName": "Card contract name 2", "contractNumber": "524404______8862", "leaf": "Y", "liabilityCategory": "N", "liabilityContractId": 70003, "liabilityContractNumber": "915555______0019" } ] } ``` ## Test case -- Success -- Tree structure for a Card Contract {#test-case--success--tree-structure-for-a-card-contract} This test case describes retrieving a tree structure stored in the CMS for a specified card contract. Note: For the `/contracts/{contract_id}/tree-summaries` endpoint, the Sandbox stores the contracts tree structure containing 15 records: * 1 top account contract * 10 subaccounts * 4 card contracts For this test case, use the following information in the request:
| Path parameter | Available value | |----------------|-----------------| | `contract_id` | 70004 | | | 70005 | | | 70011 | | | 70012 | **Sample request** `GET /contracts/70011/tree-summaries?limit=15&offset=0` **Sample response** `200` ```JSON { "count": 3, "limit": 15, "offset": 0, "total": 3, "contractSummaries": [ { "contractCategory": "Account", "contractId": 70001, "contractLevel": ".", "contractName": "Account contract name 1", "contractNumber": "915555______0017", "leaf": "N" }, { "contractCategory": "Account", "contractId": 70010, "contractLevel": ".7.", "contractName": "Account contract name 8", "contractNumber": "915555______0024", "leaf": "N", "liabilityCategory": "N", "liabilityContractId": 70001, "liabilityContractNumber": "915555______0017" }, { "contractCategory": "Card", "contractId": 70011, "contractLevel": ".7.1.", "contractName": "Card contract name 3", "contractNumber": "524404______3174", "leaf": "Y", "liabilityCategory": "N", "liabilityContractId": 70010, "liabilityContractNumber": "915555______0024" } ] } ``` ## Test case -- Success -- No tree structure {#test-case--success--no-tree-structure} This test case describes retrieving a tree structure stored in the CMS for a specified contract that does not have any contracts associated. For this test case, use the following information in the request: | Path parameter | Available value | |----------------|-----------------| | `contract_id` | 45001 | **Sample request** `GET /contracts/45001/tree-summaries` **Sample response** `200` ```JSON { "count": 1, "limit": 10, "offset": 0, "total": 1, "contractSummaries": [ { "contractCategory": "Account", "contractId": 45001, "contractLevel": ".", "contractName": "Contract name", "contractNumber": "915555______0017", "leaf": "N", "liabilityCategory": "Y", "liabilityContractId": 4124881, "liabilityContractNumber": "3219843718" } ] } ```