Chilkat Online Tools

C# / Atlassian Confluence Cloud / Get restrictions by operation

Back to Collection Items

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

Chilkat.Http http = new Chilkat.Http();
bool success;

Chilkat.JsonObject queryParams = new Chilkat.JsonObject();
queryParams.UpdateString("expand","<string>");
queryParams.UpdateString("expand","<string>");

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

Chilkat.HttpResponse resp = http.QuickRequestParams("GET","https://your-domain.atlassian.net/wiki/rest/api/content/:id/restriction/byOperation",queryParams);
if (http.LastMethodSuccess == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

Chilkat.StringBuilder sbResponseBody = new Chilkat.StringBuilder();
resp.GetBodySb(sbResponseBody);

Chilkat.JsonObject jResp = new Chilkat.JsonObject();
jResp.LoadSb(sbResponseBody);
jResp.EmitCompact = false;

Debug.WriteLine("Response Body:");
Debug.WriteLine(jResp.Emit());

int respStatusCode = resp.StatusCode;
Debug.WriteLine("Response Status Code = " + Convert.ToString(respStatusCode));
if (respStatusCode >= 400) {
    Debug.WriteLine("Response Header:");
    Debug.WriteLine(resp.Header);
    Debug.WriteLine("Failed.");

    return;
}

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

// {
//   "_links": {}
// }

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

Curl Command

curl -G -d "expand=%3Cstring%3E"
	-d "expand=%3Cstring%3E"
	-H "Authorization: Bearer <access_token>"
https://your-domain.atlassian.net/wiki/rest/api/content/:id/restriction/byOperation

Postman Collection Item JSON

{
  "name": "Get restrictions by operation",
  "request": {
    "auth": {
      "type": "oauth2"
    },
    "method": "GET",
    "header": [
    ],
    "url": {
      "raw": "{{baseUrl}}/api/content/:id/restriction/byOperation?expand=<string>&expand=<string>",
      "host": [
        "{{baseUrl}}"
      ],
      "path": [
        "api",
        "content",
        ":id",
        "restriction",
        "byOperation"
      ],
      "query": [
        {
          "key": "expand",
          "value": "<string>",
          "description": "A multi-value parameter indicating which properties of the content\nrestrictions 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 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 be queried for its restrictions."
        }
      ]
    },
    "description": "Returns restrictions on a piece of content by operation. This method is\nsimilar to [Get restrictions](#api-content-id-restriction-get) except that\nthe operations are properties of the return object, rather than items in\na results array.\n\n**[Permissions](https://confluence.atlassian.com/x/_AozKw) required**:\nPermission to view the content."
  },
  "response": [
    {
      "name": "Returned if the requested restrictions are returned.",
      "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/content/:id/restriction/byOperation?expand=<string>&expand=<string>",
          "host": [
            "{{baseUrl}}"
          ],
          "path": [
            "api",
            "content",
            ":id",
            "restriction",
            "byOperation"
          ],
          "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 \"_links\": {}\n}"
    }
  ]
}