2025-08-01 - Graph Use Case/CreateRelationship

From Izara Wiki
Jump to navigation Jump to search

Overview

Using Case

Create Relationship Basic Case

Example Param

{
  "firstObject": {
    "objType": {
      "serviceTag": "xxxx",
      "objectType": "yyyy"
    },
    "identifiers": {
      // identifiers
    }
  },
  "secondObject": {
    "objType": {
      "serviceTag": "xxxx",
      "objectType": "yyyy"
    },
    "identifiers": {
      // identifiers

    }
  },
  "relType": {
    "serviceTag": "xxxx",
    "relationshipTag": "rel"
  },
  "relationshipProperties": {
    // optionalproperties 
  },
  "relationshipDirection": "from", // or 'to'
  "settings": {
    "updateRelPropsWhenExist": false // true 
  },
  "callingFlow": "xxxx", // optional
  "callingFlowProperties": { // optional
    "graphServiceName": "GraphHandler"
  }
}

Example Output

  • Note!: If send parameter updateRelPropsWhenExist = false , return will not update relationship properties // if send parameter updateRelPropsWhenExist = true ,return will update relationship properties
{
 returnValue: {
   queryResults: {
      objects: [
        {
          objType: {
            serviceTag: "xxxx",
            objectType: "yyyy"
          },
          identifiers: {
           //identifiers
          }
        },
        {
          objType: {
            serviceTag: "xxxx",
            objectType: "yyyy"
          },
          identifiers: {
        //identifiers
          }
        }
      ],
      relType: {
        serviceTag: "xxxx",
        relationshipTag: "rel"
      },
      relationshipProperties: {
       // properties
      },
      settings: {
        updateRelPropsWhenExist: true // or false
      }
    }
  },
  requestParam: {
    // return example send param
  }
  status: "complete", // or error
  errorsFound: []
}

Create onCreateAddRelationships

Example Param

{
  firstObject: {
    objType: {
      serviceTag: "xxxx",
        objectType: "yyyy"
    },
    identifiers: {
      //identifiers
    },
    onCreateAddRelationships: [
      {
        objType: {
          serviceTag: "xxxx",
          objectType: "yyy"
        },
        identifiers: {
          //identifiers
        },
        relType: {
          serviceTag: "xxxx",
          relationshipTag: "rel"
        },
        relationshipProperties: {
          // optional properties
        },
        relationshipDirection: "from" // or to
      },
      {
        //  if have multiple onCreateAddRelationships
      }
    ]
  },
  secondObject: {
    objType: {
      serviceTag: "xxxx",
        objectType: "yyyy"
    },
    identifiers: {
      //identifiers
    },
    onCreateAddRelationships: [
      // if want to CreateAddRelationships with secondObject
    ]
  },
  relType: {
    serviceTag: "xxxx",
      relationshipTag: "relA"
  },
  relationshipDirection: "from", // or to
    relationshipProperties: {
    // optional properties
  },
  settings: {
    updateRelPropsWhenExist: false // or to 
  },
  callingFlow: "xxxx",  // optoonal
    callingFlowProperties: { // optional
    graphServiceName: "GraphHandler"
  }
}

Example Output

Create Relationship If Parent Not Have

Example Param

Example Output