Use APIs to Design and Consume Automated Test Data Services

This article explains with the help of an example about how to use exposed CA TDM Portal APIs to find and reserve the test data that you can use for your specific test cases.The complete process is as follows; you perform these tasks with the help of the exposed APIs.
tdm45
This article explains with the help of an example about how to use exposed CA TDM Portal APIs to find and reserve the test data that you can use for your specific test cases.
The complete process is as follows; you perform these tasks with the help of the exposed APIs.
This page refers to the following API Services:
Get a Security Token
Use the login API to log in and generate a security token. You use your CA TDM Portal login credentials to generate the security token. You can then use the same security token to perform all other operations. The security token remains valid for 24 hours.
Follow these steps:
  1. Access an application that allows you to encode your credentials to the Base64 format.
  2. Enter your CA TDM Portal login credentials (in the format 
    <user name>:<password>
    ) in the source field.
    Note:
     Ensure that the credentials have appropriate permissions to perform all the required operations.
  3. Click the option to encode the credentials. The encoded Base64 format for the example is displayed as follows:
    ZwRTaX5pc4SxYXSvcjptYXJtaXRl
  4. Copy the encoded value.
  5. Access the following CA TDM Portal API:
    POST
    https://<server>:<host>/TestDataManager/user/login
  6. Enter the encoded value in the 
    Authorization
     field, which is as follows for the example:
    Basic YWRtaW5pc3RyYXRvcjptYXJtaXRl
  7. Run the API to get a security token for your credentials.
  8. Note the value of the 
    token
     parameter in the response body, which is as follows for the example:
    eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
    You have successfully generated a security token that you can use in all the subsequent operations explained in this article.
Create a Connection Profile
Create a connection profile to connect to the source or target databases.
Note:
 For more information about working with connection profiles in the UI, see Create and edit Connection Profiles in the UI section.
  1. Access the following CA TDM Portal API:
    POST
    https://<server>:<host>/TDMConnectionProfileService/api/ca/v1/connectionProfiles
  2. Enter the security token in the 
    Authorization
     field as follows:
    Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
  3. Click the model schema for the 
    profile
     parameter and specify the required connection profile details. For the example used in this article, the following information was entered:
    {
    "name":"CAconprof",
    "description":"CAconprof",
    "dbType":"sql server",
    "server":"abc01-xy001",
    "port":"1433",
    "instance":"",
    "service":"",
    "database":"podb",
    "schema":"dbo",
    "username":"sa",
    "password":"[email protected]"
    }
  4. Run the API.
  5. Review the response body and note the connection profile name, which is 
    PO_Profile
     in this case.
Share the Connection Profile
After creating a connection profile, share that connecton profile with a group. The users will get access to the connection profile, only after you share the connection profile with the group to which users are associated to.
  1. Access the following CA TDM Portal API:
    POST
    https://<server>:<host>/TDMConnectionProfileService/api/ca/v1/connectionProfiles/{profileName}/actions/grantAccess
  2. Enter the security token in the 
    Authorization
     field as follows:
    Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
  3. Enter the connection profile name that you want to share in the 
    profileName
     field.
  4. Click the model schema for the 
    profile
     parameter and specify the required connection profile details. For the example used in this article, the following information was entered:
    [
    {
    "adGroup": "TDE",
    "description": "Test Data Engineers Group",
    "groupId": 6,
    "groupName": "TDE",
    "isAdminGroup": true,
    "projectId": 2616,
    "securityFunctions": {}
    }
    ]
  5. Run the API and review the response body. The response includes the group name to confirm that the specified connection profile is shared with the respective group.
Create a Project
All operations that you perform to prepare test data for non-relational data sources take place in context of a specific CA TDM project.
Note:
 For more information about working with CA TDM Portal projects in the UI, see Create and Edit Projects in the UI section.
  1. Access the following CA TDM Portal API:
    POST
    https://<server>:<host>/TDMProjectService/api/ca/v1/projects
  2. Enter the security token in the 
    Authorization
     field as follows:
    Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
  3. Click the model schema for the 
    projectInfo 
    parameter and specify the required project details. For this example, the following information was entered:
    {
    "description": "CA_Project Description",
    "inheritTables": true,
    "name": "CA_Project"
    }
  4. Run the API to create a project.
  5. Review the response body to get the project ID, which is 2716 in this case.
Create a Version
After you create a project, you must create a version for the same project.
Note:
 For more information about working with CA TDM Portal project versions in the UI, see Manage Project Versions in the UI section.
  1. Access the following CA TDM Portal API:
    POST
    https://<server>:<host>/TDMProjectService/api/ca/v1/projects
    /{projectId}/versions
  2. Enter the security token in the 
    Authorization
     field as follows:
    Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
  3. Click the model schema for the 
    versionInfo 
    parameter and specify the required version details. For this example, the following information was entered:
    {
    "description": "CA_Project version description",
    "name": "CA_Project Version"
    }
  4. Enter the project ID (2716) in the 
    projectId
     field.
  5. Run the API to create a version.
  6. Review the response body to get the version ID, which is 2717 in this case.
  7. Note the version ID. 
    This version ID is used in all the required operations explained in this article.
Register Objects
In the CA TDM Portal, you register objects so that you can perform various data manipulation operations (for example, data generation) on them. You register file objects or data tables in context of a project and its version.
For information about registering a file object, see the "Register a File Object" section in "Use APIs to Prepare Test Data for Non-Relational Sources".
For information about registering data tables using CSV files, see "Use APIs to Register and Publish CSV Files".
Create Environment
You can create multiple environments within the CA TDM implementation for your enterprise. Within an environment, you must specify connection profiles for each Data Source which are part of the CA TDM implementation.
Follow these steps:
  1. Access the following CA TDM Portal API to create environment:
    POST https://<server>:<host>/TDMDataReservationService/api/ca/v1/environments
  2. Enter the security token in the 
    Authorization
     field as follows:
    Bearer <security token>
    For the example in this article the following value was entered:
    Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
  3. Specify the following parameter values in the request body:
    1. projectId
      Specifies the ID of the project that you want to use to create a new environment. For this example, the project ID used is 2716.
    2. versionId
      Specifies the ID of the project version that you want to use to create a new environment. For this example, the project ID used is 2717.
    3. environment
      Specifies the request body for creating an environment.
      • Environment
        Specifies the environment object containing the key value pairs of the data source and connection profiles.
        • datasourcesConnectionProfiles
          Specifies the list of connection profiles that you want to associate with the environment.
          • connectionProfileName
            Specifies the name of the connection profile you want to associate with the environment.
          • connectionProfileStatus
            Specifies the current status of the respective connection profile. Following are the valid options:
            • EXISTS
            • NOTEXISTS
            • INVALID
          • name
            Specifies the name of the data source that is associated with the respective connection profile.
        • description
          Specifies the brief description for the environment.
        • name
          Specifies the name of the environment that you want to create.
        For the example used in this article, the following information was entered:
        {
        "datasourcesConnectionProfiles": [
        {
        "connectionProfileName": "CAconprof",
        "connectionProfileStatus": "EXISTS",
        "name": "CAdatasource"
        }
        ],
        "description": "CAenvironment",
        "name": "CAenvironment"
        }
  4. Run the API and review the response body.
    Creates the environment and returns the response similar to the below example:
    {
    "id": 4,
    "name": "CAenvironment",
    "description": "CAenvironment",
    "projectID": 2716,
    "versionID": 2717,
    "datasourcesConnectionProfiles": [
    {
    "name": "CAdatasource",
    "connectionProfileName": "CAconprof",
    "connectionProfileStatus": "EXISTS"
    }
    ],
    "createdBy": "Administrator",
    "modifiedBy": "Administrator",
    "creationDate": "2017-02-09 04:09:38.081",
    "modifiedDate": "2017-02-09 04:09:38.081"
    }
    Note:
     If the parameter values you entered are not valid, you may receive one of the below errors as response for the corresponding reasons:
    • 400:
       Bad Request - Specific reason is included in the error message.
    • 401:
       Unauthorized - Invalid or expired token.
    • 403:
       Forbidden - User does not have permissions to access the environment.
    • 404:
       Not Found - Specific reason is included in the error message.
    • 409:
       Conflict - Environment with the specified name already exists.
    • 500:
       Internal Server Error - Specific reason is included in the error message.
Create a Test Data Model
Follow these steps:
  1. Access the following CA TDM Portal API to create a Test Data Model:
    POST https://<server>:<host>/TDMDataReservationService/api/ca/v1/testDataModels
  2. Enter the security token in the 
    Authorization
     field as follows:
    Bearer <security token>
    For the example in this article the following value was entered:
    Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
  3. Specify the following parameter values in the request body:
    1. projectId
      Specifies the ID of the project that you want to use to create the Data Model. For this example, the project ID used is 2716.
    2. versionId
      Specifies the ID of the project version that you want to use to create the Data Model. For this example, the version ID used is 2717.
    3. testDataModel
      Specifies the request body for creating a Test Data Model.
      • TestDataModelDetails
        Specifies the Data Model object containing the key value pairs of the respective Data Model.
        • description
          Specifies a brief description for the Test Data Model that you are creating. You cannot leave the description empty.
        • Model Keys
          Specifies the list of model keys for the root entity.
        • name
          Specifies the name for the Test Data Model you are creating.
        • root
          Specifies the Root Table object containing the following Root Entity details:
          • displayName
            Specifies the display of name of root table.
          • rootEntity
            Specifies the Root Entity (Root Table) object containing the following Test Data Model root details:
            • dataSource
              Specifies the name of the Data Source for the respective root entity.
            • Name
              Specifies the name of the Root Entity (Root Table) that you want to associate.
        • visible
          Specifies the flag indicating whether the Data Model is visible or not. The value "true" indicates that the Data Model is visible, and the value "false" indicates that the Data Model is not visible. Only the data models that are visible can be used in Find the Test Data API.
          Default: 
          false
        For the example used in this article, the following information was entered:
        {
        "description": "CA Data Model",
        "modelKeys": [
        "ProductID"
        ],
        "name": "CA Data Model",
        "root": {
        "displayName": "CA Data Model",
        "rootEntity": {
        "dataSource": "CAdatasource",
        "name": "Orders"
        }
        },
        "visible": false
        }
  4. Run the API and review the response body.
    Creates the Data Model and returns the response similar to the below example:
    {
    "description": "CA Data Model",
    "modelKeys": [
    "ProductID"
    ],
    "name": "CA Data Model",
    "root": {
    "displayName": "CA Data Model",
    "rootEntity": {
    "dataSource": "CAdatasource",
    "name": "Orders"
    }
    },
    "visible": false
    }
    Note:
     If the parameter values you entered are not valid, you may receive one of the below errors as response for the corresponding reasons:
    • 400:
       Bad Request - Specific reason is included in the error message.
    • 401:
       Server authentication failed..
    • 403:
       Forbidden
    • 404:
       Not Found - Specific reason is included in the error message.
    • 409:
       Conflict - Data Model with the same name already exists.
    • 500:
       Internal Server Error - Specific reason is included in the error message.
Create Fields in a Test Data Model
You can create the fields in a Test Data Model which you can use to filter the data based on the criteria  you specify while find the test data operation.
Follow these steps:
 
  1. Access the following CA TDM Portal API:
    POST https://<server>:<host>/TDMDataReservationService/api/ca/v1/testDataModels/{testDataModelId}/fields
  2. Enter the security token in the 
    Authorization
     field as follows:
    Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
  3. Enter information in the following fields as follows:
    • testDataModelId
      Specifies the ID of the test data model that you want to use to create a new field. For this example, the Test Data Model ID used is 8.
    • projectId
      Specifies the ID of the project that includes the test data model for which you want to create a new field. For this example, the project ID used is 2716.
    • versionId
      Specifies the ID of the project version that includes the test data model for which you want to create a new field. For this example, the version ID used is 2717.
    • field
      Specifies the payload that includes the field parameters.Specify the Field parameter values that you want to use to create a field. This payload includes the following parameters:
      • associationId
        Specifies the ID of the association that is related to the field you want to create. For this example, the association ID used is 394.
      • displayName
        Specifies the display name of the field that you want to create. For this example, the display name is Order Details.
      • displayOrder
        Specifies the order in which you want to display this field (in the form) to testers. For this example, the value is 1.
      • displayType 
        Specifies the display type of the field. For this example, the value is TextBox.
      • displayValues
        Specifies the default value for the field. For this example, the value is Quantity.
      • isVisible 
        Specifies whether you want to display this field to testers. If yes, set the value to true; otherwise, set the value to false.
      • name
        Specifies the name of the field. For this example, the value is Quantity.
      For this example, the association update payload is as follows. Note that the display name of the field is selected for the update:
      {
        "associationId": 394,
        "displayName": "Order Details",
        "displayOrder": 1,
        "displayType": "TextBox",
        "displayValues": [
          "Quantity"
        ],
        "isVisible": true,
        "name": "Quantity"
      }
  4. Run the API and review the response body. The following example response is generated:
    {
      "associationId": 394,
      "dataType": "smallint",
      "displayName": "Quantity",
      "displayOrder": 1,
      "displayType": "TextBox",
      "displayValues": [
        "Quantity"
      ],
      "id": 395,
      "isVisible": true,
      "name": "Quantity",
      "projectId": 2716,
      "versionId": 2717
    }
  5. Review that the response includes the new field details. In this case, the display name of the field created is Quantity and the ID is 395.
You have successfully created a field in a test data model.
Note:
 If the parameter values you entered are not valid, you may receive one of the below errors as response for the corresponding reasons:
  • 400:
     Bad Request - Specific reason is included in the error message.
  • 401:
     Server authentication failed.
  • 403:
     Forbidden
  • 404:
     Not Found - Specific reason is included in the error message.
  • 409:
     Conflict - Specific reason is included in the error message.
  • 500:
     Internal Server Error - Specific reason is included in the error message.
Define Associations in a Test Data Model
Follow these steps:
  1. Access the following CA TDM Portal API to create an association:
    POST https://<server>:<host>/TDMDataReservationService/api/ca/v1/testDataModels/{testDataModelId}/associations
  2. Enter the security token in the 
    Authorization
     field as follows:
    Bearer <security token>
    For the example in this article the following value was entered:
    Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
  3. Specify the following parameter values in the request body:
    1. projectId
      Specifies the ID of the project for which you want to create an association. For this example, the project ID used is 2716.
    2. versionId
      Specifies the ID of the project version for which you want to create an association. For this example, the version ID used is 2717.
    3. testDataModelID
      Specifies the ID of the test data model for which you want to create an association. For this example, the Test Data Model ID used is 8.
    4. forceUpdate
      Specifies whether to create the association or not in case of conflict. Select "true", if you want to forcefully save the new association in case of a conflict.
    5. association
      Specifies the request body for defining entities and associations.
      • association
        Specifies the Association, containing the following Association details:
        • associationType 
          Specifies the type of the relationship. Following are the valid values:
          • ONE_ONE
          • ONE_MANY
          • MANY_ONE
        • joinFields
          • fieldName
            Name of the field used in the relationship.
          • referenceFieldName
            Name of the reference field used in relationship.
        • name
          Name of the association that you are creating.
        • sourceEntity
          • dataSource
            Specifies the name of the data source for the entity.
          • name
            Specifies the name of the entity or table.
        • targetEntity
          • dataSource
            Specifies the name of the data target for the entity.
          • name
            Specifies the name of the entity or table.
      For the example used in this article, the following information was entered:
      {
        "associationType": "ONE_ONE",
        "joinFields": [
          {
            "fieldName": "OrderID",
            "referenceFieldName": "OrderID"
          }
        ],
        "name": "OrderDetailsToOrders",
        "sourceEntity": {
          "dataSource": "CAdatasource",
          "name": "Orders"
        },
        "targetEntity": {
          "dataSource": "CAdatatarget",
          "name": "Orders"
        }
      }
  4. Run the API and review the response body.
    Creates the Association and returns the response similar to the below example:
    {
      "associationType": "ONE_ONE",
      "joinFields": [
        {
          "fieldName": "OrderID",
          "referenceFieldName": "OrderID"
        }
      ],
      "name": "OrderDetailsToOrders",
      "sourceEntity": {
        "dataSource": "CAdatasource",
        "name": "Orders"
      },
      "targetEntity": {
        "dataSource": "CAdatatarget",
        "name": "Orders"
      }
    }
     
    Note:
     If the parameter values you entered are not valid, you may receive one of the below errors as response for the corresponding reasons:
    • 400:
       Bad Request - Specific reason is included in the error message.
    • 401:
       Server authentication failed.
    • 403:
       Forbidden
    • 404:
       Not Found - Specific reason is included in the error message.
    • 409:
       Conflict - Association between the same entities already exists.
    • 500:
       Internal Server Error - Specific reason is included in the error message.
Enable Data Model for Finding the Test Data
When you created the data model, if you have not set the 
visible
 parameter to 
true
, the respective data model cannot be used to find the test data. You can enable the data model to use in Find the Test Data API, by changing the visible parameter value to true.
Follow these steps:
  1. Access the following CA TDM Portal API to delete the test reservation:
    PUT https://<server>:<host>/TDMDataReservationService/api/ca/v1/testDataModels/{testDataModelId}
  2. Enter the security token in the 
    Authorization
     field as follows:
    Bearer <security token>
    For the example in this article the following value was entered:
    Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
  3. Specify the following parameter values in the request body:
    1. testDataModelId
      Specifies the ID of the test data model that you want to update. For this example, the Test Data Model ID used is 8.
    2. projectId
      Specifies the ID of the project that associates the reservation you want to delete. For this example, the project ID used is 2716. 
    3. versionId
      Specifies the ID of the project version that associates the reservation you want to delete. For this example, the version ID used is 2717.
    4. testDataModel
      Specifies the request body for defining the required updates to the Test Data Model.For the example used in this article, the following information was entered:
      {
      "visible": true
      }
  4. Run the API and review the response body.
    Updated the Test Data Model and returns the response similar to the below example:
    {
      "name": "Ordersdm",
      "description": "Odersdm",
      "environmentId": 4,
      "createdBy": "Administrator",
      "modifiedBy": "Administrator",
      "rootEntity": {
        "dataSource": "CAdatasource",
        "columns": [
          {
            "displayName": "ShipRegion",
            "columnOrder": "12",
            "isKey": false,
            "isVisible": true,
            "displayDataType": "String",
            "displayValues": [
              "1"
            ],
            "id": 17,
            "projectId": 2716,
            "versionId": 2717,
            "columnName": "ShipRegion"
          },
          {
           "displayName": "Order ID",
            "columnOrder": "1",
            "isKey": true,
            "isVisible": true,
            "displayDataType": "Long",
            "displayValues": [
              "1"
            ],
            "id": 16,
            "projectId": 2716,
            "versionId": 2717,
            "columnName": "OrderID"
          },
          {
            "displayName": "ShipCountry",
            "columnOrder": "14",
            "isKey": false,
            "isVisible": true,
            "displayDataType": "String",
            "displayValues": [
              "1"
            ],
            "id": 20,
            "projectId": 2716,
            "versionId": 2717,
            "columnName": "ShipCountry"
          },
          {
            "displayName": "Customer ID",
            "columnOrder": "2",
            "isKey": false,
            "isVisible": true,
            "displayDataType": "String",
            "displayValues": [
              "1"
            ],
            "id": 22,
            "projectId": 2716,
            "versionId": 2717,
            "columnName": "CustomerID"
          },
          {
            "displayName": "ShipCity",
            "columnOrder": "11",
            "isKey": false,
            "isVisible": true,
            "displayDataType": "String",
            "displayValues": [
              "1"
            ],
            "id": 18,
            "projectId": 2716,
            "versionId": 2717,
            "columnName": "ShipCity"
          },
          {
            "displayName": "RequiredDate",
            "columnOrder": "5",
            "isKey": false,
            "isVisible": true,
            "displayDataType": "Date",
            "displayValues": [
              "1"
            ],
            "id": 14,
            "projectId": 2716,
            "versionId": 2717,
            "columnName": "RequiredDate"
          },
          {
            "displayName": "Freight",
            "columnOrder": "8",
            "isKey": false,
            "isVisible": true,
            "displayDataType": "Long",
            "displayValues": [
              "1"
            ],
            "id": 23,
            "projectId": 2716,
            "versionId": 2717,
            "columnName": "Freight"
          },
          {
            "displayName": "ShippedDate",
            "columnOrder": "6",
            "isKey": false,
            "isVisible": true,
            "displayDataType": "Date",
            "displayValues": [
              "1"
            ],
            "id": 11,
            "projectId": 2716,
            "versionId": 2717,
            "columnName": "ShippedDate"
          },
          {
            "displayName": "OrderDate",
            "columnOrder": "4",
            "isKey": false,
            "isVisible": true,
            "displayDataType": "Date",
            "displayValues": [
              "1"
            ],
            "id": 19,
            "projectId": 2716,
            "versionId": 2717,
            "columnName": "OrderDate"
          },
          {
            "displayName": "Employee ID",
            "columnOrder": "3",
            "isKey": false,
            "isVisible": true,
            "displayDataType": "Long",
            "displayValues": [
              "1"
            ],
            "id": 13,
            "projectId": 2716,
            "versionId": 2717,
            "columnName": "EmployeeID"
          },
          {
            "displayName": "ShipAddress",
            "columnOrder": "10",
            "isKey": false,
            "isVisible": true,
            "displayDataType": "String",
            "displayValues": [
              "1"
            ],
            "id": 12,
            "projectId": 2716,
            "versionId": 2717,
            "columnName": "ShipAddress"
          },
          {
            "displayName": "ShipVia",
            "columnOrder": "7",
            "isKey": false,
            "isVisible": true,
            "displayDataType": "Long",
            "displayValues": [
              "1"
            ],
            "id": 10,
            "projectId": 2716,
            "versionId": 2717,
            "columnName": "ShipVia"
          },
          {
            "displayName": "ShipPostalCode",
            "columnOrder": "13",
            "isKey": false,
            "isVisible": true,
            "displayDataType": "String",
            "displayValues": [
              "1"
            ],
            "id": 15,
            "projectId": 2716,
            "versionId": 2717,
            "columnName": "ShipPostalCode"
          },
          {
            "displayName": "ShipName",
            "columnOrder": "9",
            "isKey": false,
            "isVisible": true,
            "displayDataType": "String",
            "displayValues": [
              "1"
            ],
            "id": 21,
            "projectId": 2716,
            "versionId": 2717,
            "columnName": "ShipName"
          }
        ],
        "id": 9,
        "projectId": 2716,
        "versionId": 2717,
        "entityName": "CAentity"
      },
      "id": 8,
      "projectId": 2716,
      "versionId": 2717,
      "visible": true,
      "creationDate": "2017-02-09 04:13:21.413",
      "modifiedDate": "2017-02-09 04:13:21.413"
    }
    Note:
     If the parameter values you entered are not valid, you may receive one of the below errors as response for the corresponding reasons:
    • 400:
       Bad Request - Specific reason is included in the error message.
    • 401:
       Server authentication failed.
    • 403:
       Forbidden.
    • 404:
       Not Found - Specific reason is included in the error message.
    • 500:
       Internal Server Error - Specific reason is included in the error message.
Find the Test Data
After creating and enabling the Test Data Model, you can Find the Test Data that matches your specific test criteria.
Follow these steps:
  1. Access the following CA TDM Portal API:
    POST https://<server>:<host>/TDMDataReservationService/api/ca/v1/testDataModels/{testDataModelId}/actions/find
  2. Enter the security token in the 
    Authorization
     field as follows:
    Bearer <security token>
    For the example in this article the following value was entered:
    Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
  3. Specify the following parameter values in the request body:
    1. testDataModelId
      Specifies the ID of the test data model that you want to use for finding the test data.
    2. projectId
      Specifies the ID of the project where you want to perform the find test data. For this example, the project ID used is 2716.
    3. versionId
      Specifies the ID of the project version where you want to perform the find test data. For this example, the version ID used is 2717.
    4. requestBody
      Specifies the request body for finding the test data.
      • FindTestDataModel
        Specifies the Find Data Model object containing the key value pairs of the respective Data Model.
        • environmentID
          Specifies the ID of the Environment that is associated with the corresponding testDataModelId.
        • filters
          Specifies the filters object containing the following Find Data Model Filters:
          • fieldId
            Specifies the ID of the filter field. If you are specifying a field of date, time, datetime, or timestamp, you must provide the input in the following format:
            • Date:
               yyyy-MM-dd (for example, 2017-07-22)
            • Time:
               HH:mm:ss.SSS (for example, 14:32:28.012)
            • Datetime/Timestamp:
               yyyy-MM-dd HH:mm:ss.SSS (for example, 2017-07-22 14:32:28.012)
          • operator
            Specifies the logical operator allowed for the corresponding filter. The following are the logical operators you can use:
            • "EQUALS"
            • "NOT_EQUAL"
            • "LESS_THAN"
            • "LESS_THAN_OR_EQUAL_TO"
            • "GREATER_THAN"
            • "GREATER_THAN_OR_EQUAL_TO"
            • "CONTAINS"
            • "BETWEEN"
            • "IN_VALUES"
            • "NOT_IN_VALUES"
            • "STARTS_WITH"
            • "ENDS_WITH"
          • values
            Specifies the list of allowed values for the coresponding filter.
        • includeReservedRecords
          Specifies the flag indicating whether  to include or exclude the already reserved records in the find test data results.. The value "true" indicates to include the reserved records in the results, and the value "false" indicates to exclude.
          Default: 
          true
        • startAfterValues
          Start After Values required to find the data for remaining pages. Provide Map of model key and value which is the result of current page find result.
      For the example used in this article, the following information was entered:
      {
      "environmentId": 8,
      "filters": [
      {
      "fieldId": 2,
      "operator": "EQUALS",
      "values": ["mydata"]
      }
      {
      "fieldId": 3,
      "operator": ">",
      "values": ["300"]
      }
      ],
      "includeReservedRecords": true,
      "numberOfRecordsRequired": 10,
      "startAfterValues": {}
      }
  4. Run the API and review the response body.
    Finds the data and returns the response similar to the below example:
    {
    "records": [
    {
    "columnValues": {},
    "recordId": {
    "keys": {}
    }
    }
    ],
    "startAfterValues": {}
    }
    Note:
     If the parameter values you entered are not valid, you may receive one of the below errors as response for the corresponding reasons:
    • 400:
       Bad Request - Specific reason is included in the error message.
    • 401:
       Server authentication failed.
    • 403:
       Forbidden.
    • 404:
       Not Found - Specific reason is included in the error message.
    • 500:
       Internal Server Error - Specific reason is included in the error message.
Reserve the Test Data
After finding the data that matches your criteria, you can reserve the required data for your specific test cases.
Follow these steps:
  1. Access the following CA TDM Portal API to reserve the test data:
    POST https://<server>:<host>/TDMDataReservationService/api/ca/v1/reservations
  2. Enter the security token in the 
    Authorization
     field as follows:
    Bearer <security token>
    For the example in this article the following value was entered:
    Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
  3. Specify the following parameter values in the request body:
    1. projectId
      Specifies the ID of the project where you want to perform the data reservation. For this example, the project ID used is 2716.
    2. versionId
      Specifies the ID of the project version where you want to perform the data reservation. For this example, the version ID used is 2717.
    3. reservationInfo
      Specifies the request body for data reservation.
      • ReservationEntity
        Specifies the ReservationEntity details object containing the key value pairs of the respective Reservation.
        • dataModelId
          Specifies the ID of the Data Model that associates the reservation.
        • dataModelName
          Specifies the name of the Data Model that associates the reservation.
        • environmentId
          Specifies the ID of the Environment to use for the reservation.
        • environmentName
          Specifies the name of the Environment to use for the reservation.
        • resErrorMessage
          Specifies the user message that displays, if the reservation fails. Do not provide any input for this parameter.
        • reservationId
          Specifies the ID of the reservation that is auto generated after the reservation is performed. Do not provide any input for this parameter.
        • reservationName
          Specifies the name of the reservation.
        • reservationState
          Specifies the state of the reservation. Do not provide any input for this parameter.
        • resources
          Specifies the list of reserved entities.
      • ReservationResource
        Specifies the ReservationResource details object containing the key value pairs of the respective Reservation.
        • dataModelId
          Specifies the ID of the Data Model for the corresponding resource.
        • modelKeys
          Specifies the map of the entity key associated. For example, {"OrderID" : "O1","OrderName":"Order1"}.
    For the example used in this article, the following information was entered:
    {
    "dataModelId": 8,
    "dataModelName": CA Data Model,
    "environmentId": 4,
    "environmentName": "CAenvironment"
    "resErrorMessage": "string",
    "reservationId": 0,
    "reservationName": "CAtestdatareservation",
    "reservationState": "UNDEFINED",
    "resources": [
    {
    "dataModelId": 8,
    "modelKeys": {}
    }
    ]
    }
  4. Run the API and review the response body.
    Reserved the data and returns the response similar to the below example:
    {
    "reservationId": 2745
    }
    Note:
     If the parameter values you entered are not valid, you may receive one of the below errors as response for the corresponding reasons:
    • 202:
      Reservation request has been accepted but the resources have not been reserved yet.
    • 400:
       Bad Request - Specific reason is included in the error message.
    • 401:
       Server authentication failed.
    • 403:
       Forbidden - User does not have permissions to perform the reservation.
    • 404:
       Not Found - Specific reason is included in the error message.
    • 409:
       Conflict - Specific reason is included in the error message.
    • 500:
       Internal Server Error - Specific reason is included in the error message.
Review the Reservation Status
After reserving the data, if you want to review the reservation details you can run the get reservation status API to fetch the reservation status.
Follow these steps:
  1. Access the following CA TDM Portal API to get the test reservation:
    GET https://<server>:<host>/TDMDataReservationService/api/ca/v1/reservations/{reservationId}
  2. Enter the security token in the 
    Authorization
     field as follows:
    Bearer <security token>
    For the example in this article the following value was entered:
    Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
  3. Specify the following parameter values in the request body:
    • projectId
      Specifies the ID of the project that associates the reservation you want to review. For this example, the project ID used is 2716. 
    • versionId
      Specifies the ID of the project version that associates the reservation you want to review. For this example, the version ID used is 2717.
    • reservationId
      Specifies the ID of the reservation that you want to review. For this example the reservation ID used is 2745.
  4. Run the API and review the response body.
    Gets the reservation details and returns the response similar to the below example:
    {
    "dataModelId": 8,
    "dataModelName": CA Data Model,
    "environmentId": 4,
    "environmentName": "CAenvironment"
    "resErrorMessage": "Created",
    "reservationId": 2745,
    "reservationName": "CAtestdatareservation",
    "reservationState": "UNDEFINED",
    "resources": [
    {
    "dataModelId": 8,
    "modelKeys": {}
    }
    ]
    }
    Note:
     If the parameter values you entered are not valid, you may receive one of the below errors as response for the corresponding reasons:
    • 400:
       Bad Request - Specific reason is included in the error message.
    • 401:
       Server authentication failed - Invalid or expired token.
    • 403:
       Forbidden - User does not have permissions to delete the reservation.
    • 404:
       Not Found - Reservation with the specific ID is not found.
    • 500:
       Internal Server Error - Specific reason is included in the error message.
Review the Reservations for a User
As a tester, you can perform multiple reservations based on your test data requirement for different test cases. You can get the details of all the reservations you performed.
Follow these steps:
  1. Access the following CA TDM Portal API to get the test reservation:
    GET https://<server>:<host>/TDMDataReservationService/api/ca/v1/reservations/
  2. Enter the security token in the 
    Authorization
     field as follows:
    Bearer <security token>
    For the example in this article the following value was entered:
    Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
  3. Specify the following parameter values in the request body:
    • projectId
      (Optional) Specifies the ID of the project that associates the reservations you want to review. For this example, the project ID used is 2716. 
    • versionId
      (Optional) Specifies the ID of the project version that associates the reservations you want to review. For this example, the version ID used is 2717.
      Note:
       If you do not provide the Project ID and Version ID, the response will include all the reservations that you performed irrespective of the project version. 
    • page
      (Optional) Specifies the page number that you want to retrieve from the reservations results that span across multiple pages.
      Default: 1
      For this example, the value used is 2.
    • size
      (Optional) Specifies the number of retrieved reservations to show on each page.
      Default: 25
      For this example, the value used is 3
    • searchText
      (Optional) Specifies the search text that you want to use to filter the retrieved reservations. For this example, the value used is "data".
  4. Run the API and review the response body.
    Gets the details of the reservations performed by the respective user and returns the response similar to the below example:
    [
    {
    "numberOfReservations": 6,
    "reservations": [
    {
    "dataModelId": 8,
    "environmentId": 4,
    "resErrorMessage": "Created",
    "reservationId": 2745,
    "reservationName": "CAtestdatareservation1",
    "reservationState": "UNDEFINED",
    "reservedBy": 1682,
    "resources": [
    {
    "dataModelId": 8,
    "modelKeys": {}
    }
    ]
    }
    ],
    [
    {
    "dataModelId": 8,
    "environmentId": 4,
    "resErrorMessage": "Created",
    "reservationId": 2746,
    "reservationName": "CAtestdatareservation2",
    "reservationState": "UNDEFINED",
    "reservedBy": 1682,
    "resources": [
    {
    "dataModelId": 8,
    "modelKeys": {}
    }
    ]
    }
    ],
    [
    {
    "dataModelId": 8,
    "environmentId": 4,
    "resErrorMessage": "Created",
    "reservationId": 2747,
    "reservationName": "CAtestdatareservation3",
    "reservationState": "UNDEFINED",
    "reservedBy": 1682,
    "resources": [
    {
    "dataModelId": 8,
    "modelKeys": {}
    }
    ]
    }
    ],
    [
    {
    "dataModelId": 8,
    "environmentId": 4,
    "resErrorMessage": "Created",
    "reservationId": 2748,
    "reservationName": "CAtestdatareservation4",
    "reservationState": "UNDEFINED",
    "reservedBy": 1682,
    "resources": [
    {
    "dataModelId": 8,
    "modelKeys": {}
    }
    ]
    }
    ],
    [
    {
    "dataModelId": 8,
    "environmentId": 4,
    "resErrorMessage": "Created",
    "reservationId": 2749,
    "reservationName": "CAtestdatareservation5",
    "reservationState": "UNDEFINED",
    "reservedBy": 1682,
    "resources": [
    {
    "dataModelId": 8,
    "modelKeys": {}
    }
    ]
    }
    ],
    [
    {
    "dataModelId": 8,
    "environmentId": 4,
    "resErrorMessage": "Created",
    "reservationId": 2750,
    "reservationName": "CAtestdatareservation6",
    "reservationState": "UNDEFINED",
    "reservedBy": 1682,
    "resources": [
    {
    "dataModelId": 8,
    "modelKeys": {}
    }
    ]
    }
    ],
    "totalNumberOfReservations": 6
    }
    ]
    Note:
     If the parameter values you entered are not valid, you may receive one of the below errors as response for the corresponding reasons:
    • 400:
       Bad Request - Request does not have a valid format or has missing required parameters.
    • 401:
       Unauthorized - Invalid or expired token.
    • 403:
       Forbidden - User does not have permissions to get the reservations.
    • 404:
       Not Found - Resource not found.
    • 500:
       Internal Server Error - Specific reason is included in the error message.
(Optional) Release the Reservation
After using the reserved data for your testing and when you do not need the reservation any more, you can release the reservation.
Note:
 The released reservations are moved to "purged" state and will be permanently deleted after 30 days. This delete process runs once in every 12 hours to identify, if there are any purged reservations that are older than 30 days. You can configure these default values of delete process running interval and the number of days to keep the reservations in purged or failed state. For more information, see Configure CA TDM Portal for Deleting the Purged Reservations.
Follow these steps:
  1. Access the following CA TDM Portal API to delete the test reservation:
    DELETE https://<server>:<host>/TDMDataReservationService/api/ca/v1/reservations/{reservationId}
  2. Enter the security token in the 
    Authorization
     field as follows:
    Bearer <security token>
    For the example in this article the following value was entered:
    Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJBZG1pbmlU0VSX0lEBTExfUFJPSkVDVFNcIjpbMTAwXX0ifQ.7T1CyH_xQK0vQcBB7dLojUxm8ENTeRRrdOa-RQ5l4Ro
  3. Specify the following parameter values in the request body:
    • projectId
      Specifies the ID of the project that associates the reservation you want to delete. For this example, the project ID used is 2716. 
    • versionId
      Specifies the ID of the project version that associates the reservation you want to delete. For this example, the version ID used is 2717.
    • reservationId
      Specifies the ID of the reservation that you want to delete. For this example the reservation ID used is 2745.
  4. Run the API and review the response body.
    Reserved the data and returns the response similar to the below example:
    {
    "response": "Release operation completed successfully"
    }
    Note:
     If the parameter values you entered are not valid, you may receive one of the below errors as response for the corresponding reasons:
    • 204:
      No content.
    • 400:
       Bad Request - Specific reason is included in the error message.
    • 401:
       Server authentication failed - Invalid or expired token.
    • 403:
       Forbidden - User does not have permissions to delete the reservation.
    • 404:
       Not Found - Reservation with the specific ID is not found.
    • 500:
       Internal Server Error - Specific reason is included in the error message.