What is the best practice for populating a reference attribute?

Question

A reference attribute can be created and populated by creating an Entity to reference and then creating a relation between the two entities, which requires 2 API calls: 1 for creating the entity and another for creating the relations.

Is there any better way of populating a reference attribute? Can we do this in a single API call?

Answer

You should be able to populate the reference attribute in a single request.

POST /{object URI}/attributes/{attribute name}

When you add a reference attribute, the display of each reference attribute depends on its entity attribute configuration in tenant L3 configuration.  In the below case, an entity was created in a single call as well as populating the reference attribute values of that entity.

 

Example:

[
  {
    "type": "configuration/entityTypes/HCP",
    "attributes": {
      "Salary": [
        {
          "value": "10000"
        }
      ],
      "Department": [
        {
          "value": "sales"
        }
      ],
      "Address": [
        {
          "value": {
            "Zip": [
              {
                "value": {
                  "Zip4": [
                    {
                      "value": "641662"
                    }
                  ],
                  "Zip5": [
                    {
                      "value": "Zip"
                    }
                  ]
                }
              }
            ],
            "AddressLine1": [
              {
                "value": "101 BOB WALLACE AVE SW"
              }
            ],
            "StateProvince": [
              {
                "value": "T"
              }
            ],
            "Country": [
              {
                "value": "I"
              }
            ],
            "City": [
              {
                "value": "C"
              }
            ]
          },
          "refEntity": {
            "crosswalks": [
              {
                "type": "configuration/sources/DEA",
                "value": "surrogate"
              }
            ]
          },
          "refRelation": {
            "crosswalks": [
              {
                "type": "configuration/sources/DEA",
                "value": "RempidAddress0.5171758956735921"
              }
            ]
          }
        }
      ],
      "Employeeid": [
        {
          "value": "emp001"
        }
      ],
      "Age": [
        {
          "value": "36"
        }
      ],
      "Name": [
        {
          "value": "s"
        }
      ]
    },
    "crosswalks": [
      {
        "type": "configuration/sources/DEA",
        "value": "emp001"
      }
    ]
  }
]

References

https://docs.reltio.com/attrapi/createattr.html

https://docs.reltio.com/configapi/attrconfig.html?hl=reference%2Cattribute

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.