Add a Related Record

The various details of how to add a related record is explained in this section. You cannot add a reverse relationship. Also, perspective for child record attribute is not supported.

HTTP Method
Endpoint URL See Endpoint
Resource /records/{repositoryName}/addRelatedRecord
Request Parameters Specify the following parameters:
Name Description Type Data Type
Required
repositoryName Name of the repository. path string
Optional
workItemId Unique ID of the work item. query string
Media Type application/json
Request Model
{
  "process": false,
  "validate": false,
  "workItemId": "string",
  "record": {
    "productId": "string",
    "productIdExt": "string",
    "productKeyId": "string",
    "attributes": [
      {
        "name": "string",
        "value": "string",
        "displayName": "string",
        "multivalues": [
          {}
        ],
        "multivalue": false,
        "id": 0,
        "groupName": "string"
      }
    ],
    "repositoryName": "string",
    "relationships": {
      "relationshipAttributes": [
        {
          "name": "string",
          "value": "string",
          "displayName": "string",
          "multivalues": [
            {}
          ],
          "multivalue": false,
          "id": 0,
          "groupName": "string"
        }
      ],
      "targetRecord": {}
    },
    "deleted": false
  }
}
Response Model
{
  "responseMessages": [
    {
      "code": "string",
      "message": "string",
      "type": "string"
    }
  ],
  "records": [
    {
      "repositoryName": "string",
      "productId": "string",
      "productIdExt": "string",
      "productKeyId": "string",
      "responseAttributes": [
        {
          "attributeName": "string",
          "attributeDisplayName": "string",
          "values": [
            "string"
          ],
          "errorCode": "string",
          "errorMessage": "string",
          "errorType": "string"
        }
      ],
      "responseRelationships": [
        {
          "relationshipName": "string",
          "sourceRepositoryName": "string",
          "targetRepositoryName": "string",
          "recordId": "string",
          "recordIdExt": "string",
          "productKeyId": "string",
          "responseAttributes": [
            {
              "attributeName": "string",
              "attributeDisplayName": "string",
              "values": [
                "string"
              ],
              "errorCode": "string",
              "errorMessage": "string",
              "errorType": "string"
            }
          ]
        }
      ]
    }
  ],
  "success": false
}
Request Example Adding a related record where street name is Rockford, customer type is IT, company type is IT PVT, and the date of birth is 03/10/1986 in the "Company" and "Customer" repositories.
{
  "record": {
    "repositoryName": "Company",
    "productId": "REC1",
    "productIdExt": "REC1",
    "attributes": [
      {
        "name": "Name",
        "value": "TIBCO"
      },
      {
        "name": "Address",
        "value": "IL USA"
      },
      {
        "name": "Street",
        "multivalues": [
          "11th St",
          "Rockford"
        ],
        "multivalue": true
      },
      {
        "name": "Website",
        "value": "https://www.google.co.in/"
      },
      {
        "name": "Rating",
        "value": "10.10"
      },
      {
        "name": "CompanySource",
        "value": "IT SOURCE"
      },
      {
        "name": "CompanyRating",
        "value": "9"
      }
    ],
    "relationships": {
      "companycustomer": [
        {
          "relationshipAttributes": [
            {
              "name": "RCustomerType",
              "value": "IT"
            },
            {
              "name": "RCompanyType",
              "value": "IT PVT"
            }
          ],
          "targetRecord": {
            "repositoryName": "Customer",
            "productId": "REC2",
            "productIdExt": "REC2",
            "attributes": [
              {
                "name": "CustName",
                "value": "daniel reichard"
              },
              {
                "name": "CustAddress",
                "value": "UK"
              },
              {
                "name": "DOB",
                "value": "03/10/1986"
              },
              {
                "name": "Salary",
                "value": "45000"
              },
              {
                "name": "Gender",
                "value": "M"
              },
              {
                "name": "CustRating",
                "value": "7"
              }
            ],
            "relationships": {
              
            },
            "deleted": false
          }
        }
      ]
    },
    "deleted": false
  }
}
Response Example The response returns the message that the records are added successfully.
{
   "responseMessages": [   {
      "code": "SVC-11025",
      "message": "Service 'VALIDATE_PROCESS' executed successfully.",
      "type": "Info"
   }],
   "records": [],
   "success": true
}
Success Response Example:

Code: 200 successful operation

Error Response If the response is unsuccessful, either of the following error code is displayed:

Example:

Code: 400 Bad request

OR

Code: 500 Invalid Request

For error code response, see Error Handling .