2025-08-01 - Graph Use Case/CreateRelationship
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: [],
graphServiceTag: "GraphHandler"
}
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
{
returnValue: {
queryResult: {
relationship: { // relationships created from firstObject and secondObject
relType: {
serviceTag: 'xxxx',
relationshipTag: 'relA'
},
relationshipProperties: {
// rel Properties
}
},
firstNode: {
objTypes: [
{
serviceTag: 'xxxx',
objectType: 'yyyy'
}
],
objInstanceFull: {
identifiers: {
// identifiers
},
fields: {
// fields
},
onCreateAddRelationships: [
{
objTypes: [
{
serviceTag: 'xxxx',
objectType: 'yyyy'
}
],
objInstanceFull: {
identifiers: {},
fields: {}
},
relType: {
serviceTag: 'xxxx',
relationshipTag: 'relB'
},
relationshipProperties: {}
},
// if have multiple create relationship with firstObject
]
},
secondNode: {
objTypes: [
{
serviceTag: 'xxxx',
objectType: 'yyyy'
}
],
objInstanceFull: {
identifiers: { },
fields: { }
},
onCreateAddRelationships: [
// optional >> if has relationships created with secondObject
]
}
}
},
requestParam: {
// return example send param
}
},
status: 'complete',
errorsFound: [],
graphServiceTag: "GraphHandler"
}
Create Relationship If Parent Not Have
Example Param
{
"firstObject": {
"objType": {
"serviceTag": "xxxx",
"objectType": "yyyy"
},
"identifiers": {
// identifiers
},
"createRelationshipIfNothave": [
{
"onMatchRelationship": {
"relType": {
"serviceTag": "xxxx",
"relationshipTag": "relA"
},
"relationshipProperties": {}, // optional properties
"relationshipDirection": "from" // or to
},
"onMatchNode": {
"objType": {
"serviceTag": "xxxx",
"objectType": "yyyx"
},
"fields": {
// fields
}
}
}
],
"onCreateAddRelationships": [
{
// if want to CreateAddRelationships
"createRelationshipIfNothave": [
// if want to check createRelationshipIfNothave in onCreateAddRelationships
]
}
]
},
"secondObject": {
"objType": {
"serviceTag": "xxxx",
"objectType": "yyyy"
},
"identifiers": {
// identifiers
},
"createRelationshipIfNothave": [
// if want to check with firstObject relationshipDirection is reversed.
],
},
"relType": {
"serviceTag": "xxxx",
"relationshipTag": "relA"
},
"relationshipProperties": {
// optional properties
},
"relationshipDirection": "from", // or to
"settings": {
"updateRelPropsWhenExist": false // or true
}
}
Example Output
{
returnValue: {
queryResult: {
returnRelationships: {
relationship: {
relType: {
serviceTag: 'xxxx',
relationshipTag: 'rel'
},
relationshipProperties: {
// properties eg. relId
}
},
firstNode: {
objTypes: [
{
serviceTag: 'xxxx',
objectType: 'yyyy'
}
],
objInstanceFull: {
identifiers: {
//identifiers
},
fields: {}
}
},
secondNode: {
objTypes: [
{
serviceTag: 'xxxx',
objectType: 'yyyy'
}
],
objInstanceFull: {
identifiers: {
//identifiers
},
fields: {}
}
}
}
},
requestParams: {
// return example send param
},
status: 'complete',// or error
errorsFound: [],
graphServiceTag: 'GraphHandler',
}
}