Chilkat Online Tools

PowerBuilder / Atlassian Confluence Cloud / Find relationship from source to target

Back to Collection Items

integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp
oleobject loo_SbResponseBody
oleobject loo_JResp
integer li_RespStatusCode
string ls_Operation
string ls_TargetType
string ls_Value
string ls_V_expandableValue
string ls_UserValue
string ls_GroupValue
string ls_Operation
string ls_TargetType
integer li_AnonymousAccess
integer li_UnlicensedAccess
string ls_Name
string ls_RelationData
string ls_Source
string ls_Target
string ls_V_Type
string ls_AccountId
string ls_AccountType
string ls_V_Email
string ls_PublicName
string ls_Path
integer li_Width
integer li_Height
integer li_IsDefault
string ls_DisplayName
string ls_Operations
string ls_Details
string ls_PersonalSpace
string ls_Username
string ls_UserKey
string ls_Value
string ls_PersonalValue
integer li_Id
string ls_Key
string ls_Name
string ls_PersonalSpaceType
string ls_Status
string ls_Settings
string ls_Metadata
string ls_V_expandableOperations
string ls_LookAndFeel
string ls_Permissions
string ls_Icon
string ls_Description
string ls_Theme
string ls_History
string ls_Homepage
string ls_IconPath
integer li_IconWidth
integer li_IconHeight
integer li_IconIsDefault
string ls_PlainValue
string ls_Representation
string ls_ViewValue
string ls_ViewRepresentation
string ls_HomepageValue
integer li_Start
integer li_Limit
integer li_Size
integer li_RouteOverrideEnabled
string ls_Color
string ls_LinksColor
string ls_HoverOrFocusValue
string ls_ColorValue
string ls_BackgroundColorValue
string ls_ButtonValue
string ls_PrimaryNavigationValue
string ls_SecondaryNavigationValue
string ls_SearchValue
string ls_ScreenValue
string ls_ContainerValue
string ls_HeaderValue
string ls_BodyValue
string ls_BordersAndDividersColor
string ls_CreatedDate
string ls_RelationDataCreatedDate
string ls_FriendlyCreatedDate
integer i
integer li_Count_i

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat_9_5_0.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

loo_QueryParams = create oleobject
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_QueryParams.UpdateString("sourceStatus","<string>")
loo_QueryParams.UpdateString("targetStatus","<string>")
loo_QueryParams.UpdateString("sourceVersion","<integer>")
loo_QueryParams.UpdateString("targetVersion","<integer>")
loo_QueryParams.UpdateString("expand","<string>")
loo_QueryParams.UpdateString("expand","<string>")

// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"

loo_Resp = loo_Http.QuickRequestParams("GET","https://your-domain.atlassian.net/wiki/rest/api/relation/:relationName/from/:sourceType/:sourceKey/to/:targetType/:targetKey",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_QueryParams
    return
end if

loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")

loo_Resp.GetBodySb(loo_SbResponseBody)

loo_JResp = create oleobject
li_rc = loo_JResp.ConnectToNewObject("Chilkat_9_5_0.JsonObject")

loo_JResp.LoadSb(loo_SbResponseBody)
loo_JResp.EmitCompact = 0

Write-Debug "Response Body:"
Write-Debug loo_JResp.Emit()

li_RespStatusCode = loo_Resp.StatusCode
Write-Debug "Response Status Code = " + string(li_RespStatusCode)
if li_RespStatusCode >= 400 then
    Write-Debug "Response Header:"
    Write-Debug loo_Resp.Header
    Write-Debug "Failed."
    destroy loo_Resp
    destroy loo_Http
    destroy loo_QueryParams
    destroy loo_SbResponseBody
    destroy loo_JResp
    return
end if

destroy loo_Resp

// Sample JSON response:
// (Sample code for parsing the JSON response is shown below)

// {
//   "name": "laborum amet",
//   "_expandable": {
//     "relationData": "minim do quis",
//     "source": "quis velit dolore ut",
//     "target": "sint fugiat id repreh"
//   },
//   "_links": {},
//   "relationData": {
//     "createdBy": {
//       "type": "known",
//       "accountId": "est veniam nisi",
//       "accountType": "atlassian",
//       "email": "fugiat tempor est",
//       "publicName": "proident cillum adipisicing",
//       "profilePicture": {
//         "path": "incididunt dolore sit in eu",
//         "width": 66665902,
//         "height": 7198703,
//         "isDefault": false
//       },
//       "displayName": "mollit ex pariatur dolor",
//       "_expandable": {
//         "operations": "adipisicing in",
//         "details": "id minim sed",
//         "personalSpace": "Ut"
//       },
//       "_links": {},
//       "username": "proident ut incididunt consequat",
//       "userKey": "ipsum consequat sed ullamco aliquip",
//       "operations": [
//         {
//           "operation": "copy",
//           "targetType": "space"
//         },
//         {
//           "operation": "purge_version",
//           "targetType": "space"
//         }
//       ],
//       "details": {
//         "business": {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         },
//         "personal": {
//           "value": "<Error: Too many levels of nesting to fake this schema>"
//         }
//       },
//       "personalSpace": {
//         "id": 32251017,
//         "key": "Excepteur do",
//         "name": "est velit non",
//         "type": "deserunt occaecat",
//         "status": "in commodo incididunt non",
//         "_expandable": {
//           "settings": "ut cillum quis in",
//           "metadata": "dolore minim",
//           "operations": "anim commodo amet",
//           "lookAndFeel": "dolore Lorem",
//           "permissions": "dolore anim",
//           "icon": "deserunt ex occaecat amet",
//           "description": "cillum nostrud sint",
//           "theme": "dolor id",
//           "history": "in fugiat eu esse",
//           "homepage": "et"
//         },
//         "_links": {},
//         "icon": {
//           "path": "laboris eiusmod Excepteur eu",
//           "width": -89581460,
//           "height": -66835718,
//           "isDefault": true
//         },
//         "description": {
//           "plain": {
//             "value": "ut eu reprehenderit",
//             "representation": "view",
//             "embeddedContent": [
//               {
//                 "value": "<Error: Too many levels of nesting to fake this schema>"
//               },
//               {
//                 "value": "<Error: Too many levels of nesting to fake this schema>"
//               }
//             ]
//           },
//           "view": {
//             "value": "reprehenderit",
//             "representation": "view",
//             "embeddedContent": [
//               {
//                 "value": "<Error: Too many levels of nesting to fake this schema>"
//               },
//               {
//                 "value": "<Error: Too many levels of nesting to fake this schema>"
//               }
//             ]
//           }
//         },
//         "homepage": {
//           "value": "<Circular reference to #/components/schemas/Content detected>"
//         },
//         "metadata": {
//           "labels": {
//             "results": [
//               {
//                 "value": "<Error: Too many levels of nesting to fake this schema>"
//               },
//               {
//                 "value": "<Error: Too many levels of nesting to fake this schema>"
//               }
//             ],
//             "start": 83305188,
//             "limit": 81363289,
//             "size": -91970205,
//             "_links": {}
//           }
//         },
//         "operations": [
//           {
//             "operation": "purge",
//             "targetType": "comment"
//           },
//           {
//             "operation": "use",
//             "targetType": "blogpost"
//           }
//         ],
//         "permissions": [
//           {
//             "subjects": {
//               "_expandable": {
//                 "value": "<Error: Too many levels of nesting to fake this schema>"
//               },
//               "user": {
//                 "value": "<Error: Too many levels of nesting to fake this schema>"
//               },
//               "group": {
//                 "value": "<Error: Too many levels of nesting to fake this schema>"
//               }
//             },
//             "operation": {
//               "operation": "purge_version",
//               "targetType": "page"
//             },
//             "anonymousAccess": false,
//             "unlicensedAccess": false
//           },
//           {
//             "subjects": {
//               "_expandable": {
//                 "value": "<Error: Too many levels of nesting to fake this schema>"
//               },
//               "user": {
//                 "value": "<Error: Too many levels of nesting to fake this schema>"
//               },
//               "group": {
//                 "value": "<Error: Too many levels of nesting to fake this schema>"
//               }
//             },
//             "operation": {
//               "operation": "administer",
//               "targetType": "blogpost"
//             },
//             "anonymousAccess": false,
//             "unlicensedAccess": false
//           }
//         ],
//         "settings": {
//           "routeOverrideEnabled": true,
//           "_links": {}
//         },
//         "theme": {},
//         "lookAndFeel": {
//           "headings": {
//             "color": "fugiat irure nostrud"
//           },
//           "links": {
//             "color": "ad velit"
//           },
//           "menus": {
//             "hoverOrFocus": {
//               "value": "<Error: Too many levels of nesting to fake this schema>"
//             },
//             "color": {
//               "value": "<Error: Too many levels of nesting to fake this schema>"
//             }
//           },
//           "header": {
//             "backgroundColor": {
//               "value": "<Error: Too many levels of nesting to fake this schema>"
//             },
//             "button": {
//               "value": "<Error: Too many levels of nesting to fake this schema>"
//             },
//             "primaryNavigation": {
//               "value": "<Error: Too many levels of nesting to fake this schema>"
//             },
//             "secondaryNavigation": {
//               "value": "<Error: Too many levels of nesting to fake this schema>"
//             },
//             "search": {
//               "value": "<Error: Too many levels of nesting to fake this schema>"
//             }
//           },
//           "content": {
//             "screen": {
//               "value": "<Error: Too many levels of nesting to fake this schema>"
//             },
//             "container": {
//               "value": "<Error: Too many levels of nesting to fake this schema>"
//             },
//             "header": {
//               "value": "<Error: Too many levels of nesting to fake this schema>"
//             },
//             "body": {
//               "value": "<Error: Too many levels of nesting to fake this schema>"
//             }
//           },
//           "bordersAndDividers": {
//             "color": "do in laborum"
//           }
//         },
//         "history": {
//           "createdDate": "1968-05-01T03:07:38.118Z"
//         }
//       }
//     },
//     "createdDate": "1955-09-27T16:15:59.770Z",
//     "friendlyCreatedDate": "reprehenderit quis"
//   },
//   "source": {},
//   "target": {}
// }

// Sample code for parsing the JSON response...
// Use this online tool to generate parsing code from sample JSON: Generate JSON Parsing Code

ls_Name = loo_JResp.StringOf("name")
ls_RelationData = loo_JResp.StringOf("_expandable.relationData")
ls_Source = loo_JResp.StringOf("_expandable.source")
ls_Target = loo_JResp.StringOf("_expandable.target")
ls_V_Type = loo_JResp.StringOf("relationData.createdBy.type")
ls_AccountId = loo_JResp.StringOf("relationData.createdBy.accountId")
ls_AccountType = loo_JResp.StringOf("relationData.createdBy.accountType")
ls_V_Email = loo_JResp.StringOf("relationData.createdBy.email")
ls_PublicName = loo_JResp.StringOf("relationData.createdBy.publicName")
ls_Path = loo_JResp.StringOf("relationData.createdBy.profilePicture.path")
li_Width = loo_JResp.IntOf("relationData.createdBy.profilePicture.width")
li_Height = loo_JResp.IntOf("relationData.createdBy.profilePicture.height")
li_IsDefault = loo_JResp.BoolOf("relationData.createdBy.profilePicture.isDefault")
ls_DisplayName = loo_JResp.StringOf("relationData.createdBy.displayName")
ls_Operations = loo_JResp.StringOf("relationData.createdBy._expandable.operations")
ls_Details = loo_JResp.StringOf("relationData.createdBy._expandable.details")
ls_PersonalSpace = loo_JResp.StringOf("relationData.createdBy._expandable.personalSpace")
ls_Username = loo_JResp.StringOf("relationData.createdBy.username")
ls_UserKey = loo_JResp.StringOf("relationData.createdBy.userKey")
ls_Value = loo_JResp.StringOf("relationData.createdBy.details.business.value")
ls_PersonalValue = loo_JResp.StringOf("relationData.createdBy.details.personal.value")
li_Id = loo_JResp.IntOf("relationData.createdBy.personalSpace.id")
ls_Key = loo_JResp.StringOf("relationData.createdBy.personalSpace.key")
ls_Name = loo_JResp.StringOf("relationData.createdBy.personalSpace.name")
ls_PersonalSpaceType = loo_JResp.StringOf("relationData.createdBy.personalSpace.type")
ls_Status = loo_JResp.StringOf("relationData.createdBy.personalSpace.status")
ls_Settings = loo_JResp.StringOf("relationData.createdBy.personalSpace._expandable.settings")
ls_Metadata = loo_JResp.StringOf("relationData.createdBy.personalSpace._expandable.metadata")
ls_V_expandableOperations = loo_JResp.StringOf("relationData.createdBy.personalSpace._expandable.operations")
ls_LookAndFeel = loo_JResp.StringOf("relationData.createdBy.personalSpace._expandable.lookAndFeel")
ls_Permissions = loo_JResp.StringOf("relationData.createdBy.personalSpace._expandable.permissions")
ls_Icon = loo_JResp.StringOf("relationData.createdBy.personalSpace._expandable.icon")
ls_Description = loo_JResp.StringOf("relationData.createdBy.personalSpace._expandable.description")
ls_Theme = loo_JResp.StringOf("relationData.createdBy.personalSpace._expandable.theme")
ls_History = loo_JResp.StringOf("relationData.createdBy.personalSpace._expandable.history")
ls_Homepage = loo_JResp.StringOf("relationData.createdBy.personalSpace._expandable.homepage")
ls_IconPath = loo_JResp.StringOf("relationData.createdBy.personalSpace.icon.path")
li_IconWidth = loo_JResp.IntOf("relationData.createdBy.personalSpace.icon.width")
li_IconHeight = loo_JResp.IntOf("relationData.createdBy.personalSpace.icon.height")
li_IconIsDefault = loo_JResp.BoolOf("relationData.createdBy.personalSpace.icon.isDefault")
ls_PlainValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.description.plain.value")
ls_Representation = loo_JResp.StringOf("relationData.createdBy.personalSpace.description.plain.representation")
ls_ViewValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.description.view.value")
ls_ViewRepresentation = loo_JResp.StringOf("relationData.createdBy.personalSpace.description.view.representation")
ls_HomepageValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.homepage.value")
li_Start = loo_JResp.IntOf("relationData.createdBy.personalSpace.metadata.labels.start")
li_Limit = loo_JResp.IntOf("relationData.createdBy.personalSpace.metadata.labels.limit")
li_Size = loo_JResp.IntOf("relationData.createdBy.personalSpace.metadata.labels.size")
li_RouteOverrideEnabled = loo_JResp.BoolOf("relationData.createdBy.personalSpace.settings.routeOverrideEnabled")
ls_Color = loo_JResp.StringOf("relationData.createdBy.personalSpace.lookAndFeel.headings.color")
ls_LinksColor = loo_JResp.StringOf("relationData.createdBy.personalSpace.lookAndFeel.links.color")
ls_HoverOrFocusValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.lookAndFeel.menus.hoverOrFocus.value")
ls_ColorValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.lookAndFeel.menus.color.value")
ls_BackgroundColorValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.lookAndFeel.header.backgroundColor.value")
ls_ButtonValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.lookAndFeel.header.button.value")
ls_PrimaryNavigationValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.lookAndFeel.header.primaryNavigation.value")
ls_SecondaryNavigationValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.lookAndFeel.header.secondaryNavigation.value")
ls_SearchValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.lookAndFeel.header.search.value")
ls_ScreenValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.lookAndFeel.content.screen.value")
ls_ContainerValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.lookAndFeel.content.container.value")
ls_HeaderValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.lookAndFeel.content.header.value")
ls_BodyValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.lookAndFeel.content.body.value")
ls_BordersAndDividersColor = loo_JResp.StringOf("relationData.createdBy.personalSpace.lookAndFeel.bordersAndDividers.color")
ls_CreatedDate = loo_JResp.StringOf("relationData.createdBy.personalSpace.history.createdDate")
ls_RelationDataCreatedDate = loo_JResp.StringOf("relationData.createdDate")
ls_FriendlyCreatedDate = loo_JResp.StringOf("relationData.friendlyCreatedDate")
i = 0
li_Count_i = loo_JResp.SizeOfArray("relationData.createdBy.operations")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Operation = loo_JResp.StringOf("relationData.createdBy.operations[i].operation")
    ls_TargetType = loo_JResp.StringOf("relationData.createdBy.operations[i].targetType")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("relationData.createdBy.personalSpace.description.plain.embeddedContent")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Value = loo_JResp.StringOf("relationData.createdBy.personalSpace.description.plain.embeddedContent[i].value")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("relationData.createdBy.personalSpace.description.view.embeddedContent")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Value = loo_JResp.StringOf("relationData.createdBy.personalSpace.description.view.embeddedContent[i].value")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("relationData.createdBy.personalSpace.metadata.labels.results")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Value = loo_JResp.StringOf("relationData.createdBy.personalSpace.metadata.labels.results[i].value")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("relationData.createdBy.personalSpace.operations")
do while i < li_Count_i
    loo_JResp.I = i
    ls_Operation = loo_JResp.StringOf("relationData.createdBy.personalSpace.operations[i].operation")
    ls_TargetType = loo_JResp.StringOf("relationData.createdBy.personalSpace.operations[i].targetType")
    i = i + 1
loop
i = 0
li_Count_i = loo_JResp.SizeOfArray("relationData.createdBy.personalSpace.permissions")
do while i < li_Count_i
    loo_JResp.I = i
    ls_V_expandableValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.permissions[i].subjects._expandable.value")
    ls_UserValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.permissions[i].subjects.user.value")
    ls_GroupValue = loo_JResp.StringOf("relationData.createdBy.personalSpace.permissions[i].subjects.group.value")
    ls_Operation = loo_JResp.StringOf("relationData.createdBy.personalSpace.permissions[i].operation.operation")
    ls_TargetType = loo_JResp.StringOf("relationData.createdBy.personalSpace.permissions[i].operation.targetType")
    li_AnonymousAccess = loo_JResp.BoolOf("relationData.createdBy.personalSpace.permissions[i].anonymousAccess")
    li_UnlicensedAccess = loo_JResp.BoolOf("relationData.createdBy.personalSpace.permissions[i].unlicensedAccess")
    i = i + 1
loop


destroy loo_Http
destroy loo_QueryParams
destroy loo_SbResponseBody
destroy loo_JResp

Curl Command

curl -G -d "sourceStatus=%3Cstring%3E"
	-d "targetStatus=%3Cstring%3E"
	-d "sourceVersion=%3Cinteger%3E"
	-d "targetVersion=%3Cinteger%3E"
	-d "expand=%3Cstring%3E"
	-d "expand=%3Cstring%3E"
	-H "Authorization: Bearer <access_token>"
https://your-domain.atlassian.net/wiki/rest/api/relation/:relationName/from/:sourceType/:sourceKey/to/:targetType/:targetKey

Postman Collection Item JSON

{
  "name": "Find relationship from source to target",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/api/relation/:relationName/from/:sourceType/:sourceKey/to/:targetType/:targetKey?sourceStatus=<string>&targetStatus=<string>&sourceVersion=<integer>&targetVersion=<integer>&expand=<string>&expand=<string>",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "relation",
        ":relationName",
        "from",
        ":sourceType",
        ":sourceKey",
        "to",
        ":targetType",
        ":targetKey"
      ],
      "query": [
        {
          "key": "sourceStatus",
          "value": "<string>",
          "description": "The status of the source. This parameter is only used when the\n`sourceType` is 'content'."
        },
        {
          "key": "targetStatus",
          "value": "<string>",
          "description": "The status of the target. This parameter is only used when the\n`targetType` is 'content'."
        },
        {
          "key": "sourceVersion",
          "value": "<integer>",
          "description": "The version of the source. This parameter is only used when the\n`sourceType` is 'content' and the `sourceStatus` is 'historical'."
        },
        {
          "key": "targetVersion",
          "value": "<integer>",
          "description": "The version of the target. This parameter is only used when the\n`targetType` is 'content' and the `targetStatus` is 'historical'."
        },
        {
          "key": "expand",
          "value": "<string>",
          "description": "A multi-value parameter indicating which properties of the response\nobject to expand.\n\n- `relationData` returns information about the relationship, such as\nwho created it and when it was created.\n- `source` returns the source entity.\n- `target` returns the target entity."
        },
        {
          "key": "expand",
          "value": "<string>",
          "description": "A multi-value parameter indicating which properties of the response\nobject to expand.\n\n- `relationData` returns information about the relationship, such as\nwho created it and when it was created.\n- `source` returns the source entity.\n- `target` returns the target entity."
        }
      ],
      "variable": [
        {
          "key": "relationName",
          "value": "<string>",
          "type": "string",
          "description": "(Required) The name of the relationship. This method supports the 'favourite'\n(i.e. 'save for later') relationship as well as any other relationship\ntypes created via [Create relationship](#api-relation-relationName-from-sourceType-sourceKey-to-targetType-targetKey-put)."
        },
        {
          "key": "sourceType",
          "value": "<string>",
          "type": "string",
          "description": "(Required) The source entity type of the relationship. This must be 'user', if\nthe `relationName` is 'favourite'."
        },
        {
          "key": "sourceKey",
          "value": "<string>",
          "type": "string",
          "description": "(Required) - The identifier for the source entity:\n\n- If `sourceType` is `user`, then specify either `current` (logged-in user), the user key of the user, or\nthe account ID of the user. Note that the user key has been deprecated in favor of the account ID for this parameter. See the\n[migration guide](https://developer.atlassian.com/cloud/confluence/deprecation-notice-user-privacy-api-migration-guide/)\nfor details.\n- If `sourceType` is 'content', then specify the content ID.\n- If `sourceType` is 'space', then specify the space key."
        },
        {
          "key": "targetType",
          "value": "<string>",
          "type": "string",
          "description": "(Required) The target entity type of the relationship. This must be 'space' or\n'content', if the `relationName` is 'favourite'."
        },
        {
          "key": "targetKey",
          "value": "<string>",
          "type": "string",
          "description": "(Required) The identifier for the target entity:\n\n- If `targetType` is `user`, then specify either `current` (logged-in user), the user key of the user, or\nthe account ID of the user. Note that the user key has been deprecated in favor of the account ID for this parameter. See the\n[migration guide](https://developer.atlassian.com/cloud/confluence/deprecation-notice-user-privacy-api-migration-guide/)\nfor details.\n- If `targetType` is 'content', then specify the content ID.\n- If `targetType` is 'space', then specify the space key."
        }
      ]
    },
    "description": "Find whether a particular type of relationship exists from a source\nentity to a target entity. Note, relationships are one way.\n\nFor example, you can use this method to find whether the current user has\nselected a particular page as a favorite (i.e. 'save for later'):\n`GET https://your-domain.atlassian.net/wiki/rest/api/relation/favourite/from/user/current/to/content/123`\n\n**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:\nPermission to view both the target entity and source entity."
  },
  "response": [
    {
      "name": "Returned if the relationship exists.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": {
              "content": "Added as a part of security scheme: oauth2",
              "type": "text/plain"
            },
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/relation/:relationName/from/:sourceType/:sourceKey/to/:targetType/:targetKey?sourceStatus=<string>&targetStatus=<string>&sourceVersion=<integer>&targetVersion=<integer>&expand=<string>&expand=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "relation",
            ":relationName",
            "from",
            ":sourceType",
            ":sourceKey",
            "to",
            ":targetType",
            ":targetKey"
          ],
          "query": [
            {
              "key": "sourceStatus",
              "value": "<string>"
            },
            {
              "key": "targetStatus",
              "value": "<string>"
            },
            {
              "key": "sourceVersion",
              "value": "<integer>"
            },
            {
              "key": "targetVersion",
              "value": "<integer>"
            },
            {
              "key": "expand",
              "value": "<string>"
            },
            {
              "key": "expand",
              "value": "<string>"
            }
          ],
          "variable": [
            {
              "key": "relationName"
            },
            {
              "key": "sourceType"
            },
            {
              "key": "sourceKey"
            },
            {
              "key": "targetType"
            },
            {
              "key": "targetKey"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"name\": \"laborum amet\",\n \"_expandable\": {\n  \"relationData\": \"minim do quis\",\n  \"source\": \"quis velit dolore ut\",\n  \"target\": \"sint fugiat id repreh\"\n },\n \"_links\": {},\n \"relationData\": {\n  \"createdBy\": {\n   \"type\": \"known\",\n   \"accountId\": \"est veniam nisi\",\n   \"accountType\": \"atlassian\",\n   \"email\": \"fugiat tempor est\",\n   \"publicName\": \"proident cillum adipisicing\",\n   \"profilePicture\": {\n    \"path\": \"incididunt dolore sit in eu\",\n    \"width\": 66665902,\n    \"height\": 7198703,\n    \"isDefault\": false\n   },\n   \"displayName\": \"mollit ex pariatur dolor\",\n   \"_expandable\": {\n    \"operations\": \"adipisicing in\",\n    \"details\": \"id minim sed\",\n    \"personalSpace\": \"Ut\"\n   },\n   \"_links\": {},\n   \"username\": \"proident ut incididunt consequat\",\n   \"userKey\": \"ipsum consequat sed ullamco aliquip\",\n   \"operations\": [\n    {\n     \"operation\": \"copy\",\n     \"targetType\": \"space\"\n    },\n    {\n     \"operation\": \"purge_version\",\n     \"targetType\": \"space\"\n    }\n   ],\n   \"details\": {\n    \"business\": {\n     \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n    },\n    \"personal\": {\n     \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n    }\n   },\n   \"personalSpace\": {\n    \"id\": 32251017,\n    \"key\": \"Excepteur do\",\n    \"name\": \"est velit non\",\n    \"type\": \"deserunt occaecat\",\n    \"status\": \"in commodo incididunt non\",\n    \"_expandable\": {\n     \"settings\": \"ut cillum quis in\",\n     \"metadata\": \"dolore minim\",\n     \"operations\": \"anim commodo amet\",\n     \"lookAndFeel\": \"dolore Lorem\",\n     \"permissions\": \"dolore anim\",\n     \"icon\": \"deserunt ex occaecat amet\",\n     \"description\": \"cillum nostrud sint\",\n     \"theme\": \"dolor id\",\n     \"history\": \"in fugiat eu esse\",\n     \"homepage\": \"et\"\n    },\n    \"_links\": {},\n    \"icon\": {\n     \"path\": \"laboris eiusmod Excepteur eu\",\n     \"width\": -89581460,\n     \"height\": -66835718,\n     \"isDefault\": true\n    },\n    \"description\": {\n     \"plain\": {\n      \"value\": \"ut eu reprehenderit\",\n      \"representation\": \"view\",\n      \"embeddedContent\": [\n       {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n       },\n       {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n       }\n      ]\n     },\n     \"view\": {\n      \"value\": \"reprehenderit\",\n      \"representation\": \"view\",\n      \"embeddedContent\": [\n       {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n       },\n       {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n       }\n      ]\n     }\n    },\n    \"homepage\": {\n     \"value\": \"<Circular reference to #/components/schemas/Content detected>\"\n    },\n    \"metadata\": {\n     \"labels\": {\n      \"results\": [\n       {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n       },\n       {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n       }\n      ],\n      \"start\": 83305188,\n      \"limit\": 81363289,\n      \"size\": -91970205,\n      \"_links\": {}\n     }\n    },\n    \"operations\": [\n     {\n      \"operation\": \"purge\",\n      \"targetType\": \"comment\"\n     },\n     {\n      \"operation\": \"use\",\n      \"targetType\": \"blogpost\"\n     }\n    ],\n    \"permissions\": [\n     {\n      \"subjects\": {\n       \"_expandable\": {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n       },\n       \"user\": {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n       },\n       \"group\": {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n       }\n      },\n      \"operation\": {\n       \"operation\": \"purge_version\",\n       \"targetType\": \"page\"\n      },\n      \"anonymousAccess\": false,\n      \"unlicensedAccess\": false\n     },\n     {\n      \"subjects\": {\n       \"_expandable\": {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n       },\n       \"user\": {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n       },\n       \"group\": {\n        \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n       }\n      },\n      \"operation\": {\n       \"operation\": \"administer\",\n       \"targetType\": \"blogpost\"\n      },\n      \"anonymousAccess\": false,\n      \"unlicensedAccess\": false\n     }\n    ],\n    \"settings\": {\n     \"routeOverrideEnabled\": true,\n     \"_links\": {}\n    },\n    \"theme\": {},\n    \"lookAndFeel\": {\n     \"headings\": {\n      \"color\": \"fugiat irure nostrud\"\n     },\n     \"links\": {\n      \"color\": \"ad velit\"\n     },\n     \"menus\": {\n      \"hoverOrFocus\": {\n       \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      },\n      \"color\": {\n       \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      }\n     },\n     \"header\": {\n      \"backgroundColor\": {\n       \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      },\n      \"button\": {\n       \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      },\n      \"primaryNavigation\": {\n       \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      },\n      \"secondaryNavigation\": {\n       \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      },\n      \"search\": {\n       \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      }\n     },\n     \"content\": {\n      \"screen\": {\n       \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      },\n      \"container\": {\n       \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      },\n      \"header\": {\n       \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      },\n      \"body\": {\n       \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n      }\n     },\n     \"bordersAndDividers\": {\n      \"color\": \"do in laborum\"\n     }\n    },\n    \"history\": {\n     \"createdDate\": \"1968-05-01T03:07:38.118Z\"\n    }\n   }\n  },\n  \"createdDate\": \"1955-09-27T16:15:59.770Z\",\n  \"friendlyCreatedDate\": \"reprehenderit quis\"\n },\n \"source\": {},\n \"target\": {}\n}"
    },
    {
      "name": "Returned if the user does not have permission to view the\nrelationship.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": {
              "content": "Added as a part of security scheme: oauth2",
              "type": "text/plain"
            },
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/relation/:relationName/from/:sourceType/:sourceKey/to/:targetType/:targetKey?sourceStatus=<string>&targetStatus=<string>&sourceVersion=<integer>&targetVersion=<integer>&expand=<string>&expand=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "relation",
            ":relationName",
            "from",
            ":sourceType",
            ":sourceKey",
            "to",
            ":targetType",
            ":targetKey"
          ],
          "query": [
            {
              "key": "sourceStatus",
              "value": "<string>"
            },
            {
              "key": "targetStatus",
              "value": "<string>"
            },
            {
              "key": "sourceVersion",
              "value": "<integer>"
            },
            {
              "key": "targetVersion",
              "value": "<integer>"
            },
            {
              "key": "expand",
              "value": "<string>"
            },
            {
              "key": "expand",
              "value": "<string>"
            }
          ],
          "variable": [
            {
              "key": "relationName"
            },
            {
              "key": "sourceType"
            },
            {
              "key": "sourceKey"
            },
            {
              "key": "targetType"
            },
            {
              "key": "targetKey"
            }
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Returned if the relationship does not exist.",
      "originalRequest": {
        "method": "GET",
        "header": [
          {
            "description": {
              "content": "Added as a part of security scheme: oauth2",
              "type": "text/plain"
            },
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/relation/:relationName/from/:sourceType/:sourceKey/to/:targetType/:targetKey?sourceStatus=<string>&targetStatus=<string>&sourceVersion=<integer>&targetVersion=<integer>&expand=<string>&expand=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "relation",
            ":relationName",
            "from",
            ":sourceType",
            ":sourceKey",
            "to",
            ":targetType",
            ":targetKey"
          ],
          "query": [
            {
              "key": "sourceStatus",
              "value": "<string>"
            },
            {
              "key": "targetStatus",
              "value": "<string>"
            },
            {
              "key": "sourceVersion",
              "value": "<integer>"
            },
            {
              "key": "targetVersion",
              "value": "<integer>"
            },
            {
              "key": "expand",
              "value": "<string>"
            },
            {
              "key": "expand",
              "value": "<string>"
            }
          ],
          "variable": [
            {
              "key": "relationName"
            },
            {
              "key": "sourceType"
            },
            {
              "key": "sourceKey"
            },
            {
              "key": "targetType"
            },
            {
              "key": "targetKey"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}