2025-08-01 - Graph Use Case/CreateRelationship
Revision as of 04:35, 1 August 2025 by Seagame (talk | contribs) (→Create Relationship If Parent Not Have)
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
{
"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