cancel
Showing results for 
Search instead for 
Did you mean: 

Expression library for condensing Reltio REST API response

eguo
Former Employee

Before 2017 Winter Release, transforming a Reltio REST API response JSON object into a simple structure can be a tedious task. The expression library feature from 2017 Winter Release can make it much easier. Encouraged by @dmiller, am sharing a pipeline to showcase this technique. In this fictional scenario, the ask is that only output the Mobile phone fields.

Attached:
Community posting expression library for condensing Reltio REST API response_2017_04_12.slp (7.6 KB)
reltio.expr.txt (136 Bytes)
Fake_Reltio API response.json.txt (3.1 KB)
Phone.json.txt (288 Bytes)

How to test the example pipeline:

  1. download the pipeline file and reltio.expr.txt
  2. rename the reltio.expr.txt to reltio.expr
  3. upload the pipeline and reltio.expr to a project
  4. generate the previews

Content of the expression library file:

{
    ov: y => y.find(x => x.ov == true).value,
    findByType: (x,type) => x.find(y => this.ov(y.value.Type) == type && y.ov == true)
}

Pipeline property tab:

4786757497f660d5cba983b1015ba6cfe67d2c28.png

Pipeline:

42f387d68e20f6c490a7dc4b0ba9e0502d2da04a.jpg

First mapper:

a0ab810e59bf673a73df926e67ca2f29cc2cef42.png

Second mapper:

d79cc996b9b1ec39fbb1d2bc783bc675ea552784.png

Condensed data from the output:

[
  {
    "uri": "entities/geFfGTn",
    "updatedTime": 1492024546326,
    "attributes": {
      "FirstName": "Gr",
      "LastName": "Moun",
      "Gender": "Male",
      "Phone": {
        "CountryCode": "+1",
        "Number": "9999990003",
        "Type": "Mobile"
      }
    }
  }
]

The input Reltio API response JSON looked like this:

[
  {
    "uri": "entities/geFfGTn",
    "updatedTime": 1492024546326,
    "attributes": {
      "FirstName": [
        {
          "type": "configuration/entityTypes/Individuals/attributes/FirstName",
          "ov": true,
          "value": "Gr",
          "uri": "entities/geFfGTn/attributes/FirstName/sv4pKXS0"
        }
      ],
      "LastName": [
        {
          "type": "configuration/entityTypes/Individuals/attributes/LastName",
          "ov": true,
          "value": "Moun",
          "uri": "entities/geFfGTn/attributes/LastName/sv4pKfyW"
        }
      ],
      "Gender": [
        {
          "type": "configuration/entityTypes/Individuals/attributes/Gender",
          "ov": true,
          "value": "Male",
          "lookupCode": "M",
          "lookupRawValue": "M",
          "uri": "entities/geFfGTn/attributes/Gender/19BWhlRa3"
        }
      ],
      "Phone": [
        {
          "label": "Mobile 9999990003",
          "value": {
            "Type": [
              {
                "type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/Type",
                "ov": true,
                "value": "Mobile",
                "uri": "entities/geFfGTn/attributes/Phone/19BWhm8Cd/Type/19BWhmKzP"
              }
            ],
            "Number": [
              {
                "type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/Number",
                "ov": true,
                "value": "9999990003",
                "uri": "entities/geFfGTn/attributes/Phone/19BWhm8Cd/Number/19BWhmCSt"
              }
            ],
            "CountryCode": [
              {
                "type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/CountryCode",
                "ov": true,
                "value": "+1",
                "uri": "entities/geFfGTn/attributes/Phone/19BWhm8Cd/CountryCode/19BWhmGj9"
              }
            ]
          },
          "ov": true,
          "uri": "entities/geFfGTn/attributes/Phone/19BWhm8Cd"
        },
        {
          "label": "Home 5193217654",
          "value": {
            "Type": [
              {
                "type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/Type",
                "ov": true,
                "value": "Home",
                "uri": "entities/geFfGTn/attributes/Phone/zUqfhOhP/Type/zUqfhSxf"
              }
            ],
            "Number": [
              {
                "type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/Number",
                "ov": true,
                "value": "5193217654",
                "uri": "entities/geFfGTn/attributes/Phone/zUqfhOhP/Number/zUqfhXDv"
              }
            ],
            "CountryCode": [
              {
                "type": "configuration/entityTypes/Individuals/attributes/Phone/attributes/CountryCode",
                "ov": true,
                "value": "+1",
                "uri": "entities/geFfGTn/attributes/Phone/zUqfhOhP/CountryCode/zUqfhbUB"
              }
            ]
          },
          "ov": true,
          "uri": "entities/geFfGTn/attributes/Phone/zUqfhOhP"
        }
      ]
    }
  }
]
0 REPLIES 0