Chilkat Online Tools

DataFlex / Atlassian Confluence Cloud / Delete restrictions

Back to Collection Items

Use ChilkatAx-9.5.0-win32.pkg

Procedure Test
    Handle hoHttp
    Boolean iSuccess
    Variant vResp
    Handle hoResp
    Variant vSbResponseBody
    Handle hoSbResponseBody
    Handle hoJResp
    Integer iRespStatusCode
    String sOperation
    String sRestrictions
    String sContent
    String sValue
    String sStartValue
    String sLimitValue
    String sSizeValue
    String sResultsValue
    String sUser
    String sGroup
    String sContentValue
    Integer iStart
    Integer iLimit
    Integer iSize
    String sRestrictionsHash
    Integer i
    Integer iCount_i
    String sTemp1
    Boolean bTemp1

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

    Get Create (RefClass(cComChilkatHttp)) To hoHttp
    If (Not(IsComObjectCreated(hoHttp))) Begin
        Send CreateComObject of hoHttp
    End

    // Adds the "Authorization: Bearer <access_token>" header.
    Set ComAuthToken Of hoHttp To "<access_token>"

    Get ComQuickRequest Of hoHttp "DELETE" "https://your-domain.atlassian.net/wiki/rest/api/content/:id/restriction?expand=<string>&expand=<string>" To vResp
    If (IsComObject(vResp)) Begin
        Get Create (RefClass(cComChilkatHttpResponse)) To hoResp
        Set pvComObject Of hoResp To vResp
    End
    Get ComLastMethodSuccess Of hoHttp To bTemp1
    If (bTemp1 = False) Begin
        Get ComLastErrorText Of hoHttp To sTemp1
        Showln sTemp1
        Procedure_Return
    End

    Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
    If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
        Send CreateComObject of hoSbResponseBody
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComGetBodySb Of hoResp vSbResponseBody To iSuccess

    Get Create (RefClass(cComChilkatJsonObject)) To hoJResp
    If (Not(IsComObjectCreated(hoJResp))) Begin
        Send CreateComObject of hoJResp
    End
    Get pvComObject of hoSbResponseBody to vSbResponseBody
    Get ComLoadSb Of hoJResp vSbResponseBody To iSuccess
    Set ComEmitCompact Of hoJResp To False

    Showln "Response Body:"
    Get ComEmit Of hoJResp To sTemp1
    Showln sTemp1

    Get ComStatusCode Of hoResp To iRespStatusCode
    Showln "Response Status Code = " iRespStatusCode
    If (iRespStatusCode >= 400) Begin
        Showln "Response Header:"
        Get ComHeader Of hoResp To sTemp1
        Showln sTemp1
        Showln "Failed."
        Send Destroy of hoResp
        Procedure_Return
    End

    Send Destroy of hoResp

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

    // {
    //   "results": [
    //     {
    //       "operation": "purge",
    //       "_expandable": {
    //         "restrictions": "Excepteur dolore Ut labore",
    //         "content": "tempor esse officia"
    //       },
    //       "_links": {},
    //       "restrictions": {
    //         "user": {
    //           "results": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           },
    //           "start": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           },
    //           "limit": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           },
    //           "size": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           }
    //         },
    //         "group": {
    //           "results": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           },
    //           "start": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           },
    //           "limit": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           },
    //           "size": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           }
    //         },
    //         "_expandable": {
    //           "user": "in in mollit Ut occaecat",
    //           "group": "irure qui consectetur incididunt"
    //         }
    //       },
    //       "content": {
    //         "value": "<Circular reference to #/components/schemas/Content detected>"
    //       }
    //     },
    //     {
    //       "operation": "delete",
    //       "_expandable": {
    //         "restrictions": "nisi id",
    //         "content": "ut in mollit enim"
    //       },
    //       "_links": {},
    //       "restrictions": {
    //         "user": {
    //           "results": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           },
    //           "start": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           },
    //           "limit": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           },
    //           "size": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           }
    //         },
    //         "group": {
    //           "results": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           },
    //           "start": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           },
    //           "limit": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           },
    //           "size": {
    //             "value": "<Error: Too many levels of nesting to fake this schema>"
    //           }
    //         },
    //         "_expandable": {
    //           "user": "est voluptate",
    //           "group": "in"
    //         }
    //       },
    //       "content": {
    //         "value": "<Circular reference to #/components/schemas/Content detected>"
    //       }
    //     }
    //   ],
    //   "start": 17789838,
    //   "limit": 13313455,
    //   "size": -47874490,
    //   "restrictionsHash": "Lorem commodo pariatur Ut eiusmod",
    //   "_links": {}
    // }

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

    Get ComIntOf Of hoJResp "start" To iStart
    Get ComIntOf Of hoJResp "limit" To iLimit
    Get ComIntOf Of hoJResp "size" To iSize
    Get ComStringOf Of hoJResp "restrictionsHash" To sRestrictionsHash
    Move 0 To i
    Get ComSizeOfArray Of hoJResp "results" To iCount_i
    While (i < iCount_i)
        Set ComI Of hoJResp To i
        Get ComStringOf Of hoJResp "results[i].operation" To sOperation
        Get ComStringOf Of hoJResp "results[i]._expandable.restrictions" To sRestrictions
        Get ComStringOf Of hoJResp "results[i]._expandable.content" To sContent
        Get ComStringOf Of hoJResp "results[i].restrictions.user.results.value" To sValue
        Get ComStringOf Of hoJResp "results[i].restrictions.user.start.value" To sStartValue
        Get ComStringOf Of hoJResp "results[i].restrictions.user.limit.value" To sLimitValue
        Get ComStringOf Of hoJResp "results[i].restrictions.user.size.value" To sSizeValue
        Get ComStringOf Of hoJResp "results[i].restrictions.group.results.value" To sResultsValue
        Get ComStringOf Of hoJResp "results[i].restrictions.group.start.value" To sStartValue
        Get ComStringOf Of hoJResp "results[i].restrictions.group.limit.value" To sLimitValue
        Get ComStringOf Of hoJResp "results[i].restrictions.group.size.value" To sSizeValue
        Get ComStringOf Of hoJResp "results[i].restrictions._expandable.user" To sUser
        Get ComStringOf Of hoJResp "results[i].restrictions._expandable.group" To sGroup
        Get ComStringOf Of hoJResp "results[i].content.value" To sContentValue
        Move (i + 1) To i
    Loop



End_Procedure

Curl Command

curl -X DELETE
	-H "Authorization: Bearer <access_token>"
https://your-domain.atlassian.net/wiki/rest/api/content/:id/restriction?expand=<string>&expand=<string>

Postman Collection Item JSON

{
  "name": "Delete restrictions",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "DELETE",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/api/content/:id/restriction?expand=<string>&expand=<string>",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "content",
        ":id",
        "restriction"
      ],
      "query": [
        {
          "key": "expand",
          "value": "<string>",
          "description": "A multi-value parameter indicating which properties of the content\nrestrictions (returned in response) to expand.\n\n- `restrictions.user` returns the piece of content that the restrictions are\napplied to. Expanded by default.\n- `restrictions.group` returns the piece of content that the restrictions are\napplied to. Expanded by default.\n- `content` returns the piece of content that the restrictions are\napplied to."
        },
        {
          "key": "expand",
          "value": "<string>",
          "description": "A multi-value parameter indicating which properties of the content\nrestrictions (returned in response) to expand.\n\n- `restrictions.user` returns the piece of content that the restrictions are\napplied to. Expanded by default.\n- `restrictions.group` returns the piece of content that the restrictions are\napplied to. Expanded by default.\n- `content` returns the piece of content that the restrictions are\napplied to."
        }
      ],
      "variable": [
        {
          "key": "id",
          "value": "<string>",
          "type": "string",
          "description": "(Required) The ID of the content to remove restrictions from."
        }
      ]
    },
    "description": "Removes all restrictions (read and update) on a piece of content.\n\n**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:\nPermission to edit the content."
  },
  "response": [
    {
      "name": "Returned if the restrictions are removed.",
      "originalRequest": {
        "method": "DELETE",
        "header": [
          {
            "description": {
              "content": "Added as a part of security scheme: oauth2",
              "type": "text/plain"
            },
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/content/:id/restriction?expand=<string>&expand=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "content",
            ":id",
            "restriction"
          ],
          "query": [
            {
              "key": "expand",
              "value": "<string>"
            },
            {
              "key": "expand",
              "value": "<string>"
            }
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "OK",
      "code": 200,
      "_postman_previewlanguage": "json",
      "header": [
        {
          "key": "Content-Type",
          "value": "application/json"
        }
      ],
      "cookie": [
      ],
      "body": "{\n \"results\": [\n  {\n   \"operation\": \"purge\",\n   \"_expandable\": {\n    \"restrictions\": \"Excepteur dolore Ut labore\",\n    \"content\": \"tempor esse officia\"\n   },\n   \"_links\": {},\n   \"restrictions\": {\n    \"user\": {\n     \"results\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"start\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"limit\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"size\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     }\n    },\n    \"group\": {\n     \"results\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"start\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"limit\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"size\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     }\n    },\n    \"_expandable\": {\n     \"user\": \"in in mollit Ut occaecat\",\n     \"group\": \"irure qui consectetur incididunt\"\n    }\n   },\n   \"content\": {\n    \"value\": \"<Circular reference to #/components/schemas/Content detected>\"\n   }\n  },\n  {\n   \"operation\": \"delete\",\n   \"_expandable\": {\n    \"restrictions\": \"nisi id\",\n    \"content\": \"ut in mollit enim\"\n   },\n   \"_links\": {},\n   \"restrictions\": {\n    \"user\": {\n     \"results\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"start\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"limit\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"size\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     }\n    },\n    \"group\": {\n     \"results\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"start\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"limit\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     },\n     \"size\": {\n      \"value\": \"<Error: Too many levels of nesting to fake this schema>\"\n     }\n    },\n    \"_expandable\": {\n     \"user\": \"est voluptate\",\n     \"group\": \"in\"\n    }\n   },\n   \"content\": {\n    \"value\": \"<Circular reference to #/components/schemas/Content detected>\"\n   }\n  }\n ],\n \"start\": 17789838,\n \"limit\": 13313455,\n \"size\": -47874490,\n \"restrictionsHash\": \"Lorem commodo pariatur Ut eiusmod\",\n \"_links\": {}\n}"
    },
    {
      "name": "Returned if any of the above validation rules are violated",
      "originalRequest": {
        "method": "DELETE",
        "header": [
          {
            "description": {
              "content": "Added as a part of security scheme: oauth2",
              "type": "text/plain"
            },
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/content/:id/restriction?expand=<string>&expand=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "content",
            ":id",
            "restriction"
          ],
          "query": [
            {
              "key": "expand",
              "value": "<string>"
            },
            {
              "key": "expand",
              "value": "<string>"
            }
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Bad Request",
      "code": 400,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Returned if the calling user does not have permission to alter the\nrestrictions on the content.",
      "originalRequest": {
        "method": "DELETE",
        "header": [
          {
            "description": {
              "content": "Added as a part of security scheme: oauth2",
              "type": "text/plain"
            },
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/content/:id/restriction?expand=<string>&expand=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "content",
            ":id",
            "restriction"
          ],
          "query": [
            {
              "key": "expand",
              "value": "<string>"
            },
            {
              "key": "expand",
              "value": "<string>"
            }
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Forbidden",
      "code": 403,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    },
    {
      "name": "Returned if;\n\n- There is no content with the given ID.\n- The calling user does not have permission to view the content.",
      "originalRequest": {
        "method": "DELETE",
        "header": [
          {
            "description": {
              "content": "Added as a part of security scheme: oauth2",
              "type": "text/plain"
            },
            "key": "Authorization",
            "value": "<token>"
          }
        ],
        "url": {
          "raw": "{{baseUrl}}/api/content/:id/restriction?expand=<string>&expand=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "content",
            ":id",
            "restriction"
          ],
          "query": [
            {
              "key": "expand",
              "value": "<string>"
            },
            {
              "key": "expand",
              "value": "<string>"
            }
          ],
          "variable": [
            {
              "key": "id"
            }
          ]
        }
      },
      "status": "Not Found",
      "code": 404,
      "_postman_previewlanguage": "text",
      "header": [
        {
          "key": "Content-Type",
          "value": "text/plain"
        }
      ],
      "cookie": [
      ],
      "body": ""
    }
  ]
}