Create Relations

This operation is used to create one or more relations.

Table 1. Name
Name Description
Input Payload List of Relation objects to create (List<Map<String, Object>>).
Output Payload Updated Relation (List<Map<String, Object>>).
Data Sense

Dynamically build Output structures at design time

Map response JSON to object list

Command POST {TenantURL}/relations

Sample Request


                [{
                
                "type": "configuration/relationTypes/Partner",
                
                "startObject": {
                
                "type": "configuration/entityTypes/Company",
                
                "objectURI": "entities/JEDBkYn"
                
                },
                
                "endObject": {
                
                "type": "configuration/entityTypes/Company",
                
                "objectURI": "entities/B9AiUHQ"
                
                }
                
                }]

Sample Response

[
                
                {
                
                "index": 0,
                
                "object": {
                
                "URI": "relations/U66UjFH",
                
                "type": "configuration/relationTypes/Partner",
                
                "createdBy": "dkuznetsov@infoviewsystems.com",
                
                "createdTime": 1481530783783,
                
                "updatedBy": "dkuznetsov@infoviewsystems.com",
                
                "updatedTime": 1481533663351,
                
                "startRefPinned": false,
                
                "startRefIgnored": false,
                
                "endRefPinned": false,
                
                "endRefIgnored": false,
                
                "attributes": {},
                
                "crosswalks": [
                
                {
                
                "URI": "relations/U66UjFH/crosswalks/geJ9YJPT",
                
                "type": "configuration/sources/Reltio",
                
                "value": "U66UjFH",
                
                "reltioLoadDate": "2016-12-12T09:07:43.351Z",
                
                "createDate": "2016-12-12T09:07:43.351Z",
                
                "updateDate": "2016-12-12T09:07:43.351Z",
                
                "attributes": [],
                
                "singleAttributeUpdateDates": {}
                
                }
                
                ],
                
                "startObject": {
                
                "type": "configuration/entityTypes/Company",
                
                "objectURI": "entities/JEDBkYn",
                
                "label": "Infoview",
                
                "directionalLabel": "Partner",
                
                "crosswalks": []
                
                },
                
                "endObject": {
                
                "type": "configuration/entityTypes/Company",
                
                "objectURI": "entities/B9AiUHQ",
                
                "label": "Test Match",
                
                "directionalLabel": "Partner",
                
                "crosswalks": []
                
                }
                
                },
                
                "successful": true
                
                }
                
                ]
Table 2. Parameters
Name Type Required Notes
relationType String Yes Dynamically populated by Connector Data Sense with list of Relation Types (HasAddress / Parent / Spouse /...)
returnObjects Boolean No (false) Specifies if the response should contain created objects
options String No

Comma-separated list of different options which affect relation's JSON content in the response and the override process.

Available options:

  • sendHidden-disabled by default, relation's JSON in response will contain hidden attributes if this option is enabled.
  • partialOverride-disabled by default. In case of override of relation, when a match with an existing relation is found, only attributes that are provided in a request will be updated if this option is enabled, all other attributes will not be affected.
  • updateAttributeUpdateDates-disabled by default. In case of override of relation, when a match with an existing entity is found, "singleAttributeUpdateDates" property of crosswalks will be updated for changed and new attributes if this option is present.

Example:

options=sendHidden,partialOverride

preserveURIs Option

If this parameter is present, the API takes into account URIs that are specified inside the request. This parameter can be used for both the entities URI and for the attributes URI.

Example 1. Entities URIs in the Request

If this option is present for an entity URI, the API finds this entity and overrides it with attributes in the request. It can be used for inserting new attributes with new/existing crosswalks to entities. If this type of entity doesn't exist, the API returns the EXPLICIT_URI_OF_NON_EXISTING_OBJECT_DEFINED(242) error.

Note: Override by crosswalk is the preferable method because of performance.

Existing Entity

{
   "uri":"entities/0001L5U",
   "type":"configuration/entityTypes/HCP",
   "createdBy":"ivan",
   "createdTime":1459517575267,
   "updatedBy":"ivan",
   "updatedTime":1459517575267,
   "attributes":{
      "FirstName":[
         {
            "type":"configuration/entityTypes/HCP/attributes/FirstName",
            "ov":true,
            "value":"FirstName 1",
            "uri":"entities/0001L5U/attributes/FirstName/1n5QlE"
         }
      ]
   },
   "isFavorite":false,
   "crosswalks":[
      {
         "uri":"entities/0001L5U/crosswalks/1n5ZHk",
         "type":"configuration/sources/FB",
         "value":"entity1",
         "reltioLoadDate":"2016-04-01T18:32:55.267+05:00",
         "createDate":"2016-04-01T18:32:55.267+05:00",
         "updateDate":"2016-04-01T18:32:55.267+05:00",
         "attributes":[
            "entities/0001L5U/attributes/FirstName/1n5QlE"
         ],
         "singleAttributeUpdateDates":{       

         }
      }
   ],
   "label":"Value2 LastName1",
   "secondaryLabel":""
}

Insert New Attribute With preserverURIs by the Entity URI


POST {tenantUrl}/entities?options=preserveURIs
  
[
  {
    "uri": "entities/0001L5U",
    "type": "configuration/entityTypes/HCP",
    "attributes": {
      "LastName": [
        {
          "value": "LastName 1"
        }
      ]
    },
    "crosswalks": [
      {
        "type": "configuration/sources/FB",
        "value": "entity2"
      }
    ]
  }
]

In this case, the match entity is found by the URI and the new attribute inserted into it.

Results

{
   "uri":"entities/0001L5U",
   "type":"configuration/entityTypes/HCP",
   "createdBy":"ivan",
   "createdTime":1459517575267,
   "updatedBy":"ivan",
   "updatedTime":1459987315924,
   "attributes":{
      "FirstName":[
         {
            "type":"configuration/entityTypes/HCP/attributes/FirstName",
            "ov":true,
            "value":"FirstName 1",
            "uri":"entities/0001L5U/attributes/FirstName/1n5QlE"
         }
      ],
      "LastName":[
         {
            "type":"configuration/entityTypes/HCP/attributes/LastName",
            "ov":true,
            "value":"LastName 1",
            "uri":"entities/0001L5U/attributes/LastName/1n5QXX"
         }
      ]
   },
   "isFavorite":false,
   "crosswalks":[
      {
         "uri":"entities/0001L5U/crosswalks/1n5ZHk",
         "type":"configuration/sources/FB",
         "value":"entity1",
         "reltioLoadDate":"2016-04-01T18:32:55.267+05:00",
         "createDate":"2016-04-01T18:32:55.267+05:00",
         "updateDate":"2016-04-01T18:32:55.267+05:00",
         "attributes":[
            "entities/0001L5U/attributes/FirstName/1n5QlE"
         ],
         "singleAttributeUpdateDates":{

         }
      },
      {
         "uri":"entities/0001L5U/crosswalks/1n5ZLd",
         "type":"configuration/sources/FB",
         "value":"entity2",
         "reltioLoadDate":"2016-04-02T19:37:55.267+05:00",
         "createDate":"2016-04-02T19:37:55.267+05:00",
         "updateDate":"2016-04-02T19:37:55.267+05:00",
         "attributes":[
            "entities/0001L5U/attributes/FirstName/1n5QXX"
         ],
         "singleAttributeUpdateDates":{

         }
      }
   ],
   "label":"Value2 LastName1",
   "secondaryLabel":""
}

Example 2. Attributes URIs in the Request

URIs of attribute values can be changed during overwrite operation (of an attribute has more than one value and at least one of values were changed). As you can see in the partialOverride option example, the URI of the value of the "FirstName" attribute was changed after overwrite.

If the preserveURIs option is present for attributes, URIs of attribute values for which they were specified in the request JSON are not changed.

Existing Entity

{
   "uri":"entities/0001L5U",
   "type":"configuration/entityTypes/HCP",
   "createdBy":"ivan",
   "createdTime":1459517575267,
   "updatedBy":"ivan",
   "updatedTime":1459517575267,
   "attributes":{
      "FirstName":[
         {
            "type":"configuration/entityTypes/HCP/attributes/FirstName",
            "ov":true,
            "value":"Value2",
            "uri":"entities/0001L5U/attributes/FirstName/1n5QlE"
         },
         {
            "type":"configuration/entityTypes/HCP/attributes/FirstName",
            "ov":true,
            "value":"Value1",
            "uri":"entities/0001L5U/attributes/FirstName/1n5MUy"
         }
      ]
   },
   "isFavorite":false,
   "crosswalks":[
      {
         "uri":"entities/0001L5U/crosswalks/1n5ZHk",
         "type":"configuration/sources/FB",
         "value":"entity1",
         "reltioLoadDate":"2016-04-01T18:32:55.267+05:00",
         "createDate":"2016-04-01T18:32:55.267+05:00",
         "updateDate":"2016-04-01T18:32:55.267+05:00",
         "attributes":[
            "entities/0001L5U/attributes/FirstName/1n5QlE",
            "entities/0001L5U/attributes/FirstName/1n5MUy"
         ],
         "singleAttributeUpdateDates":{

         }
      }
   ],
   "label":"Value2 LastName1",
   "secondaryLabel":""
}

Overwrite With preserveURIs Option for Attributes

POST {tenantUrl}/entities?options=preserveURIs
  
[
  {
    "type": "configuration/entityTypes/HCP",
    "attributes": {
      "FirstName": [
        {
          "value": "Value1New",
          "uri": "entities/0001L5U/attributes/FirstName/1n5QlE"
        }
      ]
    },
    "crosswalks": [
      {
        "type": "configuration/sources/FB",
        "value": "entity1"
      }
    ]
  }
]

In this case, the match entity is found by the crosswalk, and the URI of the attribute value hasn't changed.

Results

{
   "uri":"entities/0001L5U",
   "type":"configuration/entityTypes/HCP",
   "createdBy":"ivan",
   "createdTime":1459517575267,
   "updatedBy":"ivan",
   "updatedTime":1459517956024,
   "attributes":{
      "FirstName":[
         {
            "type":"configuration/entityTypes/HCP/attributes/FirstName",
            "ov":true,
            "value":"Value1New",
            "uri":"entities/0001L5U/attributes/FirstName/1n5QlE"
         }
      ]
   },
   "isFavorite":false,
   "crosswalks":[
      {
         "uri":"entities/0001L5U/crosswalks/1n5ZHk",
         "type":"configuration/sources/FB",
         "value":"entity1",
         "reltioLoadDate":"2016-04-01T18:39:16.024+05:00",
         "createDate":"2016-04-01T18:32:55.267+05:00",
         "updateDate":"2016-04-01T18:32:55.267+05:00",
         "attributes":[
            "entities/0001L5U/attributes/FirstName/1n5QlE"
         ],
         "singleAttributeUpdateDates":{

         }
      }
   ],
   "label":"Value1New",
   "secondaryLabel":""
}